# http_server_tiny Tiny http server library using tiny http # Usage: You need to provide a error.html file to use when server return 404 error. ## Route Macro (Experimental)!!! This macro is usefull for deploying static files. #### Example ```rust route!(get_html => server, "/", ".index.html"); ``` This macro is equal to this ```rust server.add_route( &Method::Get, "/", Box::new(|_| Res::File { name: "./index.html", ct: "text/html; charset=utf-8", sc: 200, }), ); ``` ## src/main.rs ```rust use http_server_tiny::{route, HttpServer, Method, Res}; fn main() -> Result<(), Box> { let mut server = HttpServer::new("0.0.0.0:8000", "./error.html"); route!(get_html => server, "/", ".index.html"); route!(get_js => server, "/index.js", ".index.js"); server.handle_requests(Box::new(|req| { println!("INFO: {} {}", req.method, req.url); })) } ``` ## index.html ```html Hello, World

Hello, world!

``` ## index.js ```javascript console.log("Hello, world!"); ``` ## error.html ```html 404 404 ```