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

#18 in #ntex

Download history 1108/week @ 2024-07-23 1184/week @ 2024-07-30 1188/week @ 2024-08-06 1207/week @ 2024-08-13 1311/week @ 2024-08-20 1450/week @ 2024-08-27 1443/week @ 2024-09-03 1507/week @ 2024-09-10 1518/week @ 2024-09-17 1622/week @ 2024-09-24 1711/week @ 2024-10-01 2063/week @ 2024-10-08 2429/week @ 2024-10-15 2473/week @ 2024-10-22 2277/week @ 2024-10-29 2314/week @ 2024-11-05

9,890 downloads per month
Used in 50 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
~37K SLoC