Get Started
Add the dependency with a single command:
cargo add aex cargo add tokio --features full Spin up an HTTP service in 30 seconds
use aex::http::router::Router as HttpRouter; use aex::server::Server; use aex::{_sync, http}; #[tokio::main] async fn main() -> anyhow::Result<()> { let addr: SocketAddr = "0.0.0.0:8080".parse()?; let mut router = HttpRouter::default(); router.get("/", _sync!(|_| "OK")); Server::default() .push(http!(router)) .start(addr) .await?; Ok(()) } For async handlers, just wrap them with _async!
use aex::http::router::Router as HttpRouter; use aex::server::Server; use aex::{_async, http}; #[tokio::main] async fn main() -> anyhow::Result<()> { let addr: SocketAddr = "0.0.0.0:8080".parse()?; let mut router = HttpRouter::default(); // Async closure: `_async!` supports await internally, and likewise needs no annotation router.get("/", _async!(|ctx| { let html = fetch_home_page().await; // any async logic ctx.html(&html); true })); Server::default() .push(http!(router)) .start(addr) .await?; Ok(()) } 
![Why Object.keys(user) Returns string[], Not (keyof User)[]: TypeScript Means It](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2q4w48b9bzs43tynyhsf.png)