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

begin update of docs to actix-web 1.0

This commit is contained in:
Cameron Dershem
2019-06-12 04:51:45 -04:00
parent ad45f9e95a
commit 8aa39e1afb
9 changed files with 43 additions and 24 deletions

View File

@ -4,4 +4,4 @@ version = "0.7.0"
workspace = "../"
[dependencies]
actix-web = "0.7"
actix-web = "1.0"

View File

@ -4,4 +4,4 @@ version = "0.7.0"
workspace = "../"
[dependencies]
actix-web = "0.7"
actix-web = "1.0"

View File

@ -1,16 +1,34 @@
// // <setup>
// extern crate actix_web;
// use actix_web::{server, App, HttpRequest};
// fn index(_req: &HttpRequest) -> &'static str {
// "Hello world!"
// }
// // </setup>
// // <main>
// fn main() {
// server::new(|| App::new().resource("/", |r| r.f(index)))
// .bind("127.0.0.1:8088")
// .unwrap()
// .run();
// }
// // </main>
// <setup>
extern crate actix_web;
use actix_web::{server, App, HttpRequest};
use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer};
fn index(_req: &HttpRequest) -> &'static str {
"Hello world!"
fn index(_req: HttpRequest) -> HttpResponse {
HttpResponse::Ok().body("Hello world!")
}
// </setup>
// <main>
fn main() {
server::new(|| App::new().resource("/", |r| r.f(index)))
.bind("127.0.0.1:8088")
HttpServer::new(|| App::new().service(web::resource("/").to(index)))
.bind("127.0.0.1:8000")
.unwrap()
.run();
.run()
.unwrap();
}
// </main>

View File

@ -5,6 +5,6 @@ workspace = "../"
[dependencies]
actix = "0.7"
actix-web = { version="0.7", features=["alpn"] }
actix-web = "1.0"
futures = "0.1"
openssl = "0.10"

View File

@ -5,7 +5,7 @@ workspace = "../"
[dependencies]
actix = "0.7"
actix-web = "0.7"
actix-web = "1.0"
futures = "0.1"
openssl = "0.10"
serde = "1.0"