localhost-run
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

Localhost.run

Open a tunnel with localhost.run and expose the url

import { createExternalUrl } from "localhost-run";

const result = await createExternalUrl({ port: 3000 });

console.log(result);

// Prints
// {
//   domain: '1234.lhrtunnel.link',
//   secure: 'https://1234.lhrtunnel.link',
//   insecure: 'http://1234.lhrtunnel.link',
// }

Using custom domains

You can use custom domain as well, if you have an active subscription

import { createExternalUrl } from "localhost-run";

const result = await createExternalUrl({
  port: 3000,
  domain: tunnel.example.com,
});

console.log(result);

// Prints
// {
//   domain: 'tunnel.example.com',
//   secure: 'https://tunnel.example.com',
//   insecure: 'http://tunnel.example.com',
// }

Closing the tunnel

import { createExternalUrl } from "localhost-run";

const tunnel = await createExternalUrl({
  port: 3000,
});

tunnel.close(); // returns true when succeded

Notes

This is a little personal project, it's not affiliated with localhost.run.
This software currently rely on the presenc of ssh binary in your environment

Readme

Keywords

none

Package Sidebar

Install

npm i localhost-run

Weekly Downloads

5

Version

1.3.0

License

MIT

Unpacked Size

5.77 kB

Total Files

5

Last publish

Collaborators

  • ramiel