[][src]Function tide::redirect

pub fn redirect<State>(location: impl AsRef<str>) -> impl Endpoint<State>

Redirect a route to another route.

The route will be redirected with a 307, temporary redirect on a route with the same HTTP method.

Examples

let mut app = tide::new();
app.at("/").get(|_| async move { "meow" });
app.at("/nori").get(tide::redirect("/"));
app.listen("127.0.0.1:8080").await?;