Crates.io | maria |
lib.rs | maria |
version | 0.8.1 |
source | src |
created_at | 2023-07-28 23:22:49.649745 |
updated_at | 2023-09-09 12:53:45.680807 |
description | a simple expressjs like web framework builtin rust |
homepage | https://xfxpositions.github.io/maria/ |
repository | https://github.com/xfxpositions/maria |
max_upload_size | |
id | 928978 |
size | 46,144 |
use maria::{ Request, Response, Router, handler, HandlerFn, Arc, Mutex};
#[tokio::main]
async fn main(){
//defining first handler
let home: HandlerFn = handler!(_req, res, {
res.send_html("<h1>Hello from Maria!</h1>");
});
// init the router
let mut router = Router::new();
// add our handler to router
router.get("/", vec![home]);
// that's it!
router.listen(8080).await;
}
router.r#use(vec![handler!(_req,_res,{
println!("Something has came!");
})]);
now you can define a handler with using handler! macro example:
let home: HandlerFn = handler!(_req, res, {
res.send_text("Hello world!");
})
2 Examples added
Basic function documentation added
and that's done. also, documentation will come to next versions.