#server-api #tokio

webforge

A simple http server API for rust

1 unstable release

0.1.1 Sep 12, 2023
0.1.0 Sep 12, 2023

#81 in #server-api

MIT license

5KB
58 lines

WebForge

a simple http server written in rust

Example

#[tokio::main]
async fn main() {
    println!("Starting HTTP server...");
    let mut server: HTTPServer = HTTPServer::new(([127, 0, 0, 1], 8080).into());
    server.insert("/".to_string(), || {
        return (200, "index.html".to_string());
    });
    server.start().await;
}

Also make sure put the .html files in the src/res directory.

Other

quick note: for now this project is WIP.

Dependencies

~4–10MB
~103K SLoC