[][src]Function roa::router::deny

pub fn deny<E>(methods: impl AsRef<[Method]>, endpoint: E) -> Guard<E>
This is supported on feature="router" only.

A function to construct guard by black list.

Only requests with http method not in list can access this endpoint, otherwise will get a 405 METHOD NOT ALLOWED.

use roa::{App, Context, Result};
use roa::http::Method;
use roa::router::deny;

async fn foo(ctx: &mut Context) -> Result {
    Ok(())
}

let app = App::new().end(deny([Method::PUT, Method::DELETE], foo));