7 releases
0.1.6 | Aug 27, 2022 |
---|---|
0.1.5 | Aug 24, 2022 |
#51 in #serve
23 downloads per month
28KB
499 lines
Rust web framework
Easy to use, easy to set up.
use rust_web_framework::*;
/*- Initialize -*/
fn main() {
/*- Initiaize routes -*/
let routes = Route::Stack("", &[
Route::Stack("path", &[
Route::Tail(Method::GET, "enpoint", Function::S(some_function)),
Route::Tail(Method::GET, "enpoint2", Function::S(some_other_function)),
]),
]);
/*- Initiaize server -*/
start(ServerConfig {
addr: "127.0.0.1", // This will be localhost, use 0.0.0.0 if using docker
port: 8080u16, // Self explanatory
serve: Some("./static"), // Serve static files from a folder
not_found: Some("./static/404.html"), // Where to direct users going to a path which doesn't exist
routes,
}).unwrap();
// Go to 'localhost:8080/path/enpoint' to see results
}
lib.rs
:
Quickly set up a backend web framework using rust. Very fast and easy to use.
Dependencies
~250KB