| Crates.io | mini-server |
| lib.rs | mini-server |
| version | 0.2.4 |
| created_at | 2023-11-25 22:43:31.171377+00 |
| updated_at | 2025-10-09 11:59:37.194556+00 |
| description | The mini web server |
| homepage | https://github.com/luxluth/mini-server#readme |
| repository | https://github.com/luxluth/mini-server |
| max_upload_size | |
| id | 1048620 |
| size | 42,467 |
The mini rust server
cargo add mini-server
use mini_server::*;
fn main() {
let mut app = HTTPServer::default();
app.get("/", |_, _| {
"Hello World!".into()
});
app.run();
}
The path is an expression that can contains dynamic variables.
/, /this/is/a/path, .../this/is/a/@varibale, /this/is/another/#variable# and @ are prefixes for dynamic values.
@ for strings# for denoting integers (i32)#F for floats (f32)use mini_server::*;
fn main() {
let mut app = HTTPServer::default();
app.get("/hello/@name/#age", |_, exprs| {
let name = expand!(exprs, "name", PathExpr::String);
let age = expand!(exprs, "age", PathExpr::Number);
format!("Hello {name}, you are {age}!").into()
});
}
To run an example:
cargo run --example $name