darpi
A web api framework with speed and safety in mind.
One of the big goals is to catch all errors at compile time, if possible.
The framework uses hyper and ideally, the performance should be as if you were using hyper yourself.
The framework also uses shaku for compile time verifiable dependency injection.
The framework is in early development and will only be updated on github, until it's stable.
All feedback is appreciated.
A simple example
Cargo.toml
[dependencies]
darpi = {git = "https://github.com/petar-dambovaliev/darpi.git", branch = "master"}
serde = { version = "1.0", features = ["derive"] }
tokio = {version = "0.2.11", features = ["full"]}
shaku = {version = "0.5.0", features = ["thread_safe"]}
main.rs
use ;
use body_size_limit;
use Json;
use ;
use module;
use Infallible;
pub async
// the handler macro has 2 optional arguments
// the shaku container type and a collection of middlewares
// the enum variant `Admin` is corresponding to the middlewre `access_control`'s Expect<UserRole>
// Json<Name> is extracted from the request body
// failure to do so will result in an error response
// here we pass in the string "John Doe" to the `hello_middleware`
// it is being passed on matching the `handler: Expect<&str>` argument
// then we use the builtin body_size_limit middleware and we limit the body size
// to 64 bytes
async
module!
async