mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-03 21:07:39 +03:00
introduce route predicates
This commit is contained in:
parent
57fd35ffc1
commit
3bf3738e65
20 changed files with 370 additions and 122 deletions
|
@ -108,7 +108,8 @@ fn main() {
|
|||
HttpServer::new(
|
||||
Application::default("/")
|
||||
.middleware(middlewares::Logger::default()) // <- register logger middleware
|
||||
.resource("/ws/", |r| r.get(|req| ws::start(req, MyWebSocket))) // <- websocket route
|
||||
.resource("/ws/", |r| r.method(Method::GET)
|
||||
.handler(|req| ws::start(req, MyWebSocket))) // <- websocket route
|
||||
.route("/", fs::StaticFiles::new("examples/static/", true))) // <- serve static files
|
||||
.serve::<_, ()>("127.0.0.1:8080").unwrap();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue