2019-06-19 06:20:50 +02:00
|
|
|
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<()> {
|
2019-06-19 06:20:50 +02:00
|
|
|
HttpServer::new(|| {
|
|
|
|
App::new()
|
|
|
|
.service(
|
|
|
|
web::scope("/app1")
|
2019-06-20 00:00:31 +02:00
|
|
|
.data(State1)
|
2019-06-19 06:20:50 +02:00
|
|
|
.route("/", web::to(|| HttpResponse::Ok())))
|
|
|
|
.service(
|
|
|
|
web::scope("/app2")
|
2019-06-20 00:00:31 +02:00
|
|
|
.data(State2)
|
2019-06-19 06:20:50 +02:00
|
|
|
.route("/", web::to(|| HttpResponse::Ok())))
|
|
|
|
})
|
2019-12-28 17:15:22 +01:00
|
|
|
.bind("127.0.0.1:8088")?
|
2019-06-19 06:20:50 +02:00
|
|
|
.run()
|
2019-12-28 17:15:22 +01:00
|
|
|
.await
|
2019-06-19 06:20:50 +02:00
|
|
|
}
|
|
|
|
// </combine>
|