1
0
mirror of https://github.com/actix/actix-website synced 2024-11-24 08:43:01 +01:00
actix-website/examples/application/src/combine.rs

26 lines
606 B
Rust
Raw Normal View History

use actix_web::{web, App, HttpResponse, HttpServer};
// <combine>
struct State1;
struct State2;
#[rustfmt::skip]
2019-12-28 17:15:22 +01:00
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.service(
web::scope("/app1")
.data(State1)
.route("/", web::to(|| HttpResponse::Ok())))
.service(
web::scope("/app2")
.data(State2)
.route("/", web::to(|| HttpResponse::Ok())))
})
2019-12-28 17:15:22 +01:00
.bind("127.0.0.1:8088")?
.run()
2019-12-28 17:15:22 +01:00
.await
}
// </combine>