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

enable logger

This commit is contained in:
Nikolay Kim
2019-03-06 19:45:45 -08:00
parent 51860a4f2a
commit c4df3356c7
4 changed files with 10 additions and 10 deletions

View File

@ -2,7 +2,8 @@
use std::io;
use actix_web::{
blocking, extract::Path, web, App, Error, HttpResponse, HttpServer, State,
blocking, extract::Path, middleware, web, App, Error, HttpResponse, HttpServer,
State,
};
use futures::Future;
use r2d2::Pool;
@ -48,6 +49,7 @@ fn main() -> io::Result<()> {
HttpServer::new(move || {
App::new()
.state(pool.clone()) // <- store db pool in app state
.middleware(middleware::Logger::default())
.route("/{name}", web::get().to_async(index))
})
.bind("127.0.0.1:8080")?