Browse Source

initial commit

master
Stephen 1 month ago
commit
62d59f28e4
5 changed files with 1295 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. +1260
    -0
      Cargo.lock
  3. +13
    -0
      Cargo.toml
  4. +2
    -0
      rustfmt.toml
  5. +19
    -0
      src/main.rs

+ 1
- 0
.gitignore View File

@ -0,0 +1 @@
/target

+ 1260
- 0
Cargo.lock
File diff suppressed because it is too large
View File


+ 13
- 0
Cargo.toml View File

@ -0,0 +1,13 @@
[package]
name = "p3-warp-benchmark"
version = "0.1.0"
authors = ["Stephen <stephen@stephendownward.ca>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
warp = "0.2"
parking_lot = "0.10.0"
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "0.2", features = ["full"] }

+ 2
- 0
rustfmt.toml View File

@ -0,0 +1,2 @@
tab_spaces = 4
hard_tabs = true

+ 19
- 0
src/main.rs View File

@ -0,0 +1,19 @@
use warp::Filter;
async fn sum(num1: f64, num2: f64) -> Result<impl warp::Reply, warp::Rejection> {
let sum = num1 + num2;
Ok(warp::reply::json(&sum))
}
#[tokio::main]
async fn main() {
let post_sum = warp::get()
.and(warp::path("sum"))
.and(warp::path::param())
.and(warp::path::param())
.and(warp::path::end())
.and_then(sum);
warp::serve(post_sum).run(([127, 0, 0, 1], 3030)).await;
}

Loading…
Cancel
Save