Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nuriofernandez/rust-experiment-http-api-tokio-warp
Experimental project to test Rust language and with 'warp' and 'tokio' libraries
https://github.com/nuriofernandez/rust-experiment-http-api-tokio-warp
example-project experiment rust-lang tokio-rs warp
Last synced: 2 days ago
JSON representation
Experimental project to test Rust language and with 'warp' and 'tokio' libraries
- Host: GitHub
- URL: https://github.com/nuriofernandez/rust-experiment-http-api-tokio-warp
- Owner: nuriofernandez
- Created: 2021-06-27T13:14:25.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-06-27T14:04:19.000Z (over 3 years ago)
- Last Synced: 2024-01-03T14:36:02.313Z (10 months ago)
- Topics: example-project, experiment, rust-lang, tokio-rs, warp
- Language: Rust
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust experimental HTTP API
Experimental project to test the Rust language and the 'warp' and 'tokio' libraries
```rust
// GET / => 200 OK with body "It works!"
let default = warp::path::end().map(|| "It works!");// GET /hello/warp => 200 OK with body "Hello, warp!"
let hello = warp::path!("hello" / String)
.map(|name| format!("Hello, {}!", name));// GET /bye/nurio => 200 OK with body "Bye, nurio!"
let bye = warp::path!("bye" / String)
.map(|name| format!("Bye, {}!", name));// Map filters
let routes = default.or(hello).or(bye);// Start the http server
warp::serve(routes)
.run(([127, 0, 0, 1], 3030))
.await;
```