Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 12 days ago
JSON representation

Expose your localhost to the web. Ultra-simple deno wrapper for ngrok.

Awesome Lists containing this project

README

        


trains between usb and usb port abstract illustration

ngrok



Expose your localhost to the web. Ultra-simple deno wrapper for ngrok



build status
language
code size
issues
license
version



View on deno.land








## Usage

```ts
import { Ngrok } from "https://deno.land/x/[email protected]/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/[email protected]/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/[email protected]/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

[![Stargazers repo roster for @khrj/ngrok](https://reporoster.com/stars/khrj/ngrok)](https://github.com/khrj/ngrok/stargazers)

[![Forkers repo roster for @khrj/ngrok](https://reporoster.com/forks/khrj/ngrok)](https://github.com/khrj/ngrok/network/members)

## Related

- [Deno modules](https://github.com/khrj/deno-modules)