use tokio::main macro
This commit is contained in:
@@ -5,8 +5,8 @@ authors = ["Jared Burce <jaredr@gmail.com>"]
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
warp = "0.2"
|
|
||||||
webrtc-unreliable = "0.4"
|
|
||||||
tokio = "0.2"
|
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
pretty_env_logger = "0.4"
|
pretty_env_logger = "0.4"
|
||||||
|
tokio = { version = "0.2", features = ["macros"] }
|
||||||
|
warp = "0.2"
|
||||||
|
webrtc-unreliable = "0.4"
|
||||||
|
|||||||
19
src/main.rs
19
src/main.rs
@@ -1,19 +1,14 @@
|
|||||||
// use tokio::prelude::*;
|
|
||||||
use warp::Filter;
|
use warp::Filter;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
#[tokio::main(basic_scheduler)]
|
||||||
|
async fn main() {
|
||||||
pretty_env_logger::init();
|
pretty_env_logger::init();
|
||||||
|
|
||||||
let mut rt = tokio::runtime::Runtime::new()?;
|
let root = warp::get()
|
||||||
rt.block_on(async {
|
.and(warp::path::end())
|
||||||
let root = warp::get()
|
.and(warp::fs::file("./static/index.html"));
|
||||||
.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;
|
warp::serve(routes).run(([127, 0, 0, 1], 8060)).await;
|
||||||
});
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Hello, World!</title>
|
<title>Hello, World!</title>
|
||||||
|
|||||||
Reference in New Issue
Block a user