Created
June 7, 2020 05:14
-
-
Save espeon/0f8001365bb981ed97acb4e033bf15b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use dotenv; | |
| use warp::Filter; | |
| #[tokio::main] | |
| async fn main() { | |
| dotenv::dotenv().ok(); | |
| let hello = warp::any().map(|| { | |
| "Hello from warp!" | |
| }); | |
| let hello_from_warp = warp::path!("img" / u32 / u32).map(|x,y| { | |
| format!("Your lucky numbers are {} and {}",x, y) | |
| }); | |
| let routes = hello_from_warp.or(hello); | |
| warp::serve(routes).run(([188, 165, 236, 229], 3030)).await; | |
| println!("Hey! Open up localhost:3030 in your browser!") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment