Skip to content

svrem/lwwsws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lwwsws

lwwsws is a very basic http webserver based on strings, that only uses the standard rust library.

Example

Basic server using async functions.

use lwwsws::HttpServer;

async fn get_string() -> String {
    "Hello, World!".to_string()
}

#[tokio::main]
async fn main() {
    let handler = |path: String| async move {
        match path.as_str() {
            "/" => Some(get_string().await),
            "/hello" => Some("Wow, this is a new route!".to_string()),
            _ => None,
        }
    };

    let http_server = HttpServer::new(handler);

    http_server.run("127.0.0.1:8080").await;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages