mirror of
https://github.com/JonasunderscoreJones/jonas_jones-api.git
synced 2025-10-23 09:09:18 +02:00
proof of concept
This commit is contained in:
parent
aea93a5527
commit
6abba646c7
14 changed files with 1099 additions and 69098 deletions
18
src/main.rs
Normal file
18
src/main.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
use warp::Filter;
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() {
|
||||
// GET /hello/warp => 200 OK with body "Hello, warp!"
|
||||
let hello = warp::path!("hello" / String)
|
||||
.map(|name| format!("Hello, {}!", name));
|
||||
|
||||
let root = warp::path::end()
|
||||
.map(|| "Hello, World!");
|
||||
|
||||
|
||||
let routes = hello.or(root);
|
||||
|
||||
warp::serve(routes)
|
||||
.run(([127, 0, 0, 1], 3030))
|
||||
.await;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue