Skip to content

ngrok-samples/rust-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages