echoreq 1.0.0

Simple webserver to echo http requests -- headers, etc, including multipart form-data (binary converted to printable chars). For testing!
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use tokio::net::TcpListener;

use echoreq::router;

const DEFAULT_PORT: usize = 3000;

#[tokio::main]
async fn main() {
    let port = match std::env::var("PORT") {
        Ok(s) => s.parse::<usize>().unwrap_or(DEFAULT_PORT),
        _ => DEFAULT_PORT,
    };

    println!("Listening on {port}");
    let listener = TcpListener::bind(&format!("0.0.0.0:{port}")).await.unwrap();
    axum::serve(listener, router()).await.unwrap();
}