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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user