1
0
mirror of https://github.com/actix/examples synced 2025-02-08 20:06:07 +01:00
2019-12-25 20:48:33 +04:00

22 lines
532 B
Rust

use actix_files as fs;
use actix_web::{middleware, App, HttpServer};
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=info");
env_logger::init();
HttpServer::new(|| {
App::new()
// enable logger
.wrap(middleware::Logger::default())
.service(
// static files
fs::Files::new("/", "./static/").index_file("index.html"),
)
})
.bind("127.0.0.1:8080")?
.run()
.await
}