[][src]Function reign_router::serve

pub async fn serve<A, R>(addr: A, f: R) -> Result<(), HyperError> where
    A: ToSocketAddrs + Send + 'static,
    R: Fn(&mut Router), 

Create the server using the given routing definition

Examples

use reign::router::{serve, Router};

fn router(r: &mut Router) {}

#[tokio::main]
async fn main() {
    serve("127.0.0.1:8080", router).await.unwrap();
}