1
0
mirror of https://github.com/actix/actix-website synced 2024-11-24 00:41:07 +01:00

Outdent examples

This commit is contained in:
Armin Ronacher 2018-05-27 10:49:14 -07:00
parent be72dac069
commit ede773dd93

View File

@ -6,31 +6,31 @@ mod state;
fn make_app() { fn make_app() {
// <make_app> // <make_app>
fn index(req: HttpRequest) -> impl Responder { fn index(req: HttpRequest) -> impl Responder {
"Hello world!" "Hello world!"
} }
let app = App::new() let app = App::new()
.prefix("/app") .prefix("/app")
.resource("/index.html", |r| r.method(Method::GET).f(index)) .resource("/index.html", |r| r.method(Method::GET).f(index))
.finish() .finish()
// </make_app> // </make_app>
; ;
} }
fn run_server() { fn run_server() {
// <run_server> // <run_server>
let server = server::new(|| { let server = server::new(|| {
vec![ vec![
App::new() App::new()
.prefix("/app1") .prefix("/app1")
.resource("/", |r| r.f(|r| HttpResponse::Ok())), .resource("/", |r| r.f(|r| HttpResponse::Ok())),
App::new() App::new()
.prefix("/app2") .prefix("/app2")
.resource("/", |r| r.f(|r| HttpResponse::Ok())), .resource("/", |r| r.f(|r| HttpResponse::Ok())),
App::new().resource("/", |r| r.f(|r| HttpResponse::Ok())), App::new().resource("/", |r| r.f(|r| HttpResponse::Ok())),
] ]
}); });
// </run_server> // </run_server>
} }