Skip to content

Instantly share code, notes, and snippets.

@itslukej
Created March 11, 2020 23:51
Show Gist options
  • Select an option

  • Save itslukej/6ecad11e47b09411c31017f314c8611b to your computer and use it in GitHub Desktop.

Select an option

Save itslukej/6ecad11e47b09411c31017f314c8611b to your computer and use it in GitHub Desktop.
use warp::Filter;
use dotenv::dotenv;
use std::env;
#[tokio::main]
async fn main() {
dotenv().ok();
let port = env::var("PORT")
.expect("Port not found")
.parse()
.unwrap();
let pp = warp::path("penis")
.and(warp::path::param())
.map(|uid: f64| {
let size = /* PROPRIETARY ALGORITHM */;
let rounded = size.round();
return format!("{}", rounded);
});
println!("Listening on {}", &port);
warp::serve(pp)
.run(([0, 0, 0, 0], port))
.await;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment