mirror of
https://github.com/actix/actix-website
synced 2025-06-27 07:29:02 +02:00
convert server examples
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "getting-started"
|
||||
version = "0.1.0"
|
||||
version = "0.6.0"
|
||||
workspace = "../"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "0.6"
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user