Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.36 KB

File metadata and controls

54 lines (39 loc) · 1.36 KB

ngrok Rust SDK Quickstart

A minimal Rust app demonstrating the ngrok Rust SDK.

What you'll need

Setup

  1. Build the project (this will download dependencies):

    cargo build
  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 update the domain variable in src/endpoint.rs.

Running the app

  1. Start the Rust service:

    cargo run --bin service
  2. In another terminal, start the ngrok agent endpoint:

    NGROK_AUTHTOKEN=your_token_here cargo run --bin endpoint

    Or if you created a .env file:

    cargo run --bin endpoint

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

Files

  • src/service.rs - Basic Rust HTTP server
  • src/endpoint.rs - ngrok agent endpoint configuration with OAuth
  • .env.example - Environment variable template
  • Cargo.toml - Rust dependencies and binary configuration