Macro finchers::routes[][src]

macro_rules! routes {
    () => { ... };
    ($h:expr) => { ... };
    ($h:expr,) => { ... };
    ($e1:expr, $e2:expr) => { ... };
    ($e1:expr, $e2:expr,) => { ... };
    ($e1:expr, $e2:expr, $($t:expr),*) => { ... };
    ($e1:expr, $e2:expr, $($t:expr,)+) => { ... };
}

A helper macro for creating the instance ofEndpoint from multiple routes.

Example

#[macro_use]
extern crate finchers;

use finchers::prelude::*;

let get_post = path!(@get / i32 /)
    .map(|id| format!("get_post: {}", id));

let add_post = path!(@post /)
    .and(endpoints::body::text())
    .map(|data: String| format!("add_post: {}", data));

// ...

let endpoint = path!(/ "posts")
    .and(routes![
        get_post,
        add_post,
        // ...
    ]);