13 releases

0.2.2 Aug 26, 2024
0.2.1 Aug 26, 2024
0.1.9 Jul 11, 2024
0.1.7 Jun 26, 2024
0.1.6 May 29, 2024

#410 in HTTP server

Download history 105/week @ 2024-06-20 47/week @ 2024-06-27 16/week @ 2024-07-04 199/week @ 2024-07-11 64/week @ 2024-07-25 16/week @ 2024-08-01 96/week @ 2024-08-15 270/week @ 2024-08-22 45/week @ 2024-08-29 48/week @ 2024-09-12 13/week @ 2024-09-19 27/week @ 2024-09-26 10/week @ 2024-10-03

98 downloads per month

MIT license

60KB
1.5K SLoC

Http Server

Simple HTTP Server in rust.


lib.rs:

Http Server Crate

This crate contains all the libraries necessary to run an HTTP Server

Example

use http_srv::prelude::*;

let config = ServerConfig::default();

let mut handler = Handler::new();
handler.add_default(RequestMethod::GET, handler::cat_handler);
handler.get("/", handler::root_handler);
handler.get("/hello", |req| {
    let name = req.param("name").unwrap_or("friend");
    let msg = format!("Hello {name}!");
    req.respond_str(&msg)
});

let mut server = HttpServer::new(config);
server.set_handler(handler);
server.run();

Dependencies

~335–790KB
~19K SLoC