1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

upgrade to 2.0 alpha.3

This commit is contained in:
Nikolay Kim
2019-12-07 23:59:24 +06:00
parent e7f7175b7b
commit 3127352797
100 changed files with 1075 additions and 1107 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "template-tera"
version = "0.1.0"
version = "2.0.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
workspace = ".."
edition = "2018"
@ -8,4 +8,5 @@ edition = "2018"
[dependencies]
env_logger = "0.6"
tera = "0.11"
actix-web = "1.0.0"
actix-web = "2.0.0-alpha.3"
actix-rt = "1.0.0-alpha.3"

View File

@ -6,7 +6,7 @@ use std::collections::HashMap;
use actix_web::{error, middleware, web, App, Error, HttpResponse, HttpServer};
// store tera template in application state
fn index(
async fn index(
tmpl: web::Data<tera::Tera>,
query: web::Query<HashMap<String, String>>,
) -> Result<HttpResponse, Error> {
@ -24,7 +24,8 @@ fn index(
Ok(HttpResponse::Ok().content_type("text/html").body(s))
}
fn main() -> std::io::Result<()> {
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=info");
env_logger::init();
@ -38,5 +39,6 @@ fn main() -> std::io::Result<()> {
.service(web::resource("/").route(web::get().to(index)))
})
.bind("127.0.0.1:8080")?
.run()
.start()
.await
}