4 releases

0.1.3 Feb 24, 2021
0.1.2 Feb 24, 2021
0.1.1 Feb 24, 2021
0.1.0 Apr 10, 2020

#19 in #ntex

Download history 1461/week @ 2024-03-06 1195/week @ 2024-03-13 1567/week @ 2024-03-20 1144/week @ 2024-03-27 1295/week @ 2024-04-03 1514/week @ 2024-04-10 1400/week @ 2024-04-17 1711/week @ 2024-04-24 1343/week @ 2024-05-01 1543/week @ 2024-05-08 1165/week @ 2024-05-15 1334/week @ 2024-05-22 1383/week @ 2024-05-29 1513/week @ 2024-06-05 1014/week @ 2024-06-12 944/week @ 2024-06-19

5,275 downloads per month
Used in 46 crates (4 directly)

MIT license

17KB
350 lines

Macros for ntex::web framework Build Status


lib.rs:

ntex macros module

Generators for routes

Route

Macros:

Attributes:

  • "path" - Raw literal string with path for which to register handle. Mandatory.
  • guard = "function_name" - Registers function as guard using ntex::web::guard::fn_guard
  • error = "ErrorRenderer" - Register handler for specified error renderer

Notes

Function name can be specified as any expression that is going to be accessible to the generate code (e.g my_guard or my_module::my_guard)

Example:

use ntex::web::{get, Error, HttpResponse};
use futures::{future, Future};

#[get("/test")]
async fn async_test() -> Result<HttpResponse, Error> {
    Ok(HttpResponse::Ok().finish())
}

Dependencies

~1.5MB
~35K SLoC