https://github.com/khrj/ngrok
Expose your localhost to the web. Ultra-simple deno wrapper for ngrok.
https://github.com/khrj/ngrok
deno expose localhost module ngrok web wrapper
Last synced: 8 months ago
JSON representation
Expose your localhost to the web. Ultra-simple deno wrapper for ngrok.
- Host: GitHub
- URL: https://github.com/khrj/ngrok
- Owner: khrj
- License: mit
- Created: 2020-10-25T07:10:35.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-08-03T20:43:01.000Z (over 3 years ago)
- Last Synced: 2025-05-21T20:47:13.990Z (9 months ago)
- Topics: deno, expose, localhost, module, ngrok, web, wrapper
- Language: TypeScript
- Homepage: https://deno.land/x/ngrok
- Size: 86.9 KB
- Stars: 11
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Usage
```ts
import { Ngrok } from "https://deno.land/x/ngrok@4.0.2/mod.ts"
const ngrok = await Ngrok.create({
protocol: "http",
port: 8080,
})
ngrok.addEventListener("ready", (event) => {
console.log(event.detail) // Outputs a URL without the protocol, such as "33a229cb0344.ngrok.io"
})
// ...
await ngrok.destroy()
```
- `Ngrok.create` accepts `NgrokOptions`
```ts
interface NgrokOptions {
protocol: string
port: number
region?: string
subdomain?: string
authtoken?: string
extraArgs?: string[]
}
```
### Disconnecting
Due to the way child-processes work, ngrok will continue running in the
background even after your program exits unless you destroy the instance
```ts
import { Ngrok } from "https://deno.land/x/ngrok@4.0.2/mod.ts"
const ngrok = await Ngrok.create({
protocol: "http",
port: 8080,
})
await ngrok.destroy()
```
- Optionally provide an exit code: `await ngrok.destroy("SIGKILL")`
### API
See [generated documentation](https://doc.deno.land/https/deno.land/x/ngrok@4.0.2/mod.ts)
## Permissions
- --allow-read
- --allow-write
- --allow-env
- --allow-net
- --allow-run
```bash
deno run --allow-read --allow-write --allow-env --allow-net --allow-run test.ts
```
alternatively, specify only -A
```bash
deno run -A test.ts
```
## Supporters
[](https://github.com/khrj/ngrok/stargazers)
[](https://github.com/khrj/ngrok/network/members)
## Related
- [Deno modules](https://github.com/khrj/deno-modules)