use tokio::main macro
This commit is contained in:
19
src/main.rs
19
src/main.rs
@@ -1,19 +1,14 @@
|
||||
// use tokio::prelude::*;
|
||||
use warp::Filter;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
#[tokio::main(basic_scheduler)]
|
||||
async fn main() {
|
||||
pretty_env_logger::init();
|
||||
|
||||
let mut rt = tokio::runtime::Runtime::new()?;
|
||||
rt.block_on(async {
|
||||
let root = warp::get()
|
||||
.and(warp::path::end())
|
||||
.and(warp::fs::file("./static/index.html"));
|
||||
let root = warp::get()
|
||||
.and(warp::path::end())
|
||||
.and(warp::fs::file("./static/index.html"));
|
||||
|
||||
let routes = root;
|
||||
let routes = root;
|
||||
|
||||
warp::serve(routes).run(([127, 0, 0, 1], 8060)).await;
|
||||
});
|
||||
|
||||
Ok(())
|
||||
warp::serve(routes).run(([127, 0, 0, 1], 8060)).await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user