Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.18 KB

File metadata and controls

50 lines (37 loc) · 1.18 KB

ngrok JavaScript SDK Quickstart

A minimal Node.js app demonstrating the ngrok JavaScript SDK.

What you'll need

Setup

  1. Install dependencies:

    npm install
  2. Create a .env file from the example:

    cp .env.example .env
  3. Add your ngrok auth token to the .env file:

    NGROK_AUTHTOKEN=your_actual_authtoken_here
  4. Reserve a domain in the ngrok dashboard and add it to the .env file:

    NGROK_RESERVED_DOMAIN=your_actual_domain_here

Running the app

  1. Start the Node.js service:

    npm run service
  2. In another terminal, start the ngrok agent endpoint:

    npm run endpoint

The ngrok agent endpoint will output a URL that forwards traffic to your local app.

Files

  • service.js - Basic Node.js HTTP server
  • endpoint.js - ngrok agent endpoint configuration with OAuth
  • .env.example - Environment variable template