[][src]Function roa_router::deny

pub fn deny<E>(methods: impl AsRef<[Method]>, endpoint: E) -> Guard<E>

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_core::{App, Context, Result};
use roa_core::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));