1
0
mirror of https://github.com/actix/actix-website synced 2025-06-27 15:39:02 +02:00

convert server examples

This commit is contained in:
Nikolay Kim
2018-05-23 20:39:15 -07:00
parent d4e2aa8ae9
commit d27ab00b71
17 changed files with 185 additions and 211 deletions

View File

@ -1,6 +1,6 @@
// <setup>
extern crate actix_web;
use actix_web::{HttpRequest, App, server};
use actix_web::{server, App, HttpRequest};
fn index(_req: HttpRequest) -> &'static str {
"Hello world!"
@ -8,11 +8,9 @@ fn index(_req: HttpRequest) -> &'static str {
// </setup>
// <main>
fn main() {
server::new(|| {
App::new()
.resource("/", |r| r.f(index))
})
.bind("127.0.0.1:8088").unwrap()
.run();
server::new(|| App::new().resource("/", |r| r.f(index)))
.bind("127.0.0.1:8088")
.unwrap()
.run();
}
// </main>