Repository
Current version released
4 years ago
Usage
import { Ngrok } from "https://deno.land/x/ngrok@3.0.0/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"
})
// ...
ngrok.destroy()
Ngrok.create
acceptsNgrokOptions
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
import { Ngrok } from "https://deno.land/x/ngrok@3.0.0/mod.ts"
const ngrok = await Ngrok.create({
protocol: "http",
port: 8080,
})
ngrok.destroy()
- Optionally provide an exit code:
ngrok.destroy(9)
API
Permissions
- –allow-read
- –allow-write
- –allow-env
- –allow-net
- –allow-run
Also requires –unstable
deno run --unstable --allow-read --allow-write --allow-env --allow-net --allow-run test.ts
alternatively, specify only -A
deno run --unstable -A test.ts