mirror of https://github.com/http-rs/tide
init wasm live reload example
This commit is contained in:
parent
afe91242de
commit
cbfcaed9fb
|
@ -51,6 +51,7 @@ surf = { version = "2.0.0-alpha.3", default-features = false, features = ["h1-cl
|
|||
serde = { version = "1.0.102", features = ["derive"] }
|
||||
criterion = "0.3.1"
|
||||
tempdir = "0.3.7"
|
||||
html-index = "0.3.2"
|
||||
|
||||
[[test]]
|
||||
name = "nested"
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
use tide::{log, Request, Response};
|
||||
|
||||
#[async_std::main]
|
||||
async fn main() -> Result<(), std::io::Error> {
|
||||
log::start();
|
||||
|
||||
let mut app = tide::new();
|
||||
app.at("/").get(serve_html);
|
||||
app.at("/src").serve_dir("target/")?;
|
||||
app.listen("127.0.0.1:8080").await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn serve_html(_: Request<()>) -> tide::Result {
|
||||
let html = html_index::new()
|
||||
.title("Tide live-reloading WASM server example");
|
||||
Ok(Response::from_res(html))
|
||||
}
|
Loading…
Reference in New Issue