1
0
mirror of https://github.com/actix/examples synced 2025-03-31 07:52:32 +02:00
2019-03-26 06:29:00 +03:00

20 lines
497 B
Rust

use actix_files as fs;
use actix_web::{middleware, App, HttpServer};
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()
}