Rocket/core/codegen/tests/async-routes.rs
2020-07-11 10:48:08 -07:00

20 lines
370 B
Rust

#![allow(dead_code)]
#[macro_use] extern crate rocket;
use rocket::http::uri::Origin;
use rocket::request::Request;
async fn noop() { }
#[get("/")]
async fn hello(_origin: &Origin<'_>) -> &'static str {
noop().await;
"Hello, world!"
}
#[catch(404)]
async fn not_found(req: &Request<'_>) -> String {
noop().await;
format!("{} not found", req.uri())
}