Skip to main content

middleware

Macro middleware 

Source
macro_rules! middleware {
    (|$req:ident, $res:ident, $ctx:ident| $body:block) => { ... };
}
Expand description

The middleware! macro allows you to define middleware functions concisely without repeating type signatures.

§Usage

Use the argument form to access request, response, and context objects:

app.get("/", middleware!(|req, res, ctx| {
    res.send_text("Hello, world!");
    next!()
}));

This macro expands to a closure with the correct types for Feather’s middleware system.