get/get.rs
1use express_rs::Express;
2
3fn main() {
4 let mut app = Express::new();
5 app.get("/", |_, res| res.send("Hello World!".to_string()));
6 app.get("/hello", |_, res| {
7 res.send("<h1>Hi from /hello!</h1>".to_string())
8 });
9
10 app.get("/redirect", |_, res| {
11 res.status(301)
12 .send("This route has a redirect status code!".to_string())
13 });
14
15 app.listen(8080);
16}