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

cleanup and cargo fmt

This commit is contained in:
Nikolay Kim
2018-05-20 21:03:29 -07:00
parent 2d97219195
commit e4f1833215
28 changed files with 108 additions and 112 deletions

View File

@ -2,14 +2,10 @@
name = "static_index"
version = "0.1.0"
authors = ["Jose Marinez <digeratus@gmail.com>"]
workspace = "../"
[dependencies]
futures = "0.1"
env_logger = "0.5"
actix = "^0.5.5"
actix-web = { git="https://github.com/actix/actix-web.git" }
[workspace]
members = [
"./"
]
actix = "0.5"
actix-web = "0.6"

View File

@ -2,31 +2,27 @@ extern crate actix;
extern crate actix_web;
extern crate env_logger;
use actix_web::{fs, App, server, middleware};
use actix_web::{fs, middleware, server, App};
fn main() {
::std::env::set_var("RUST_LOG", "actix_web=info");
::std::env::set_var("RUST_BACKTRACE", "1");
env_logger::init();
let sys = actix::System::new("static_index");
server::new(
|| App::new()
server::new(|| {
App::new()
// enable logger
.middleware(middleware::Logger::default())
.handler(
"/",
fs::StaticFiles::new("./static/").index_file("index.html")
)
)
.bind("127.0.0.1:8080").expect( "Can not start server on given IP/Port" )
)
}).bind("127.0.0.1:8080")
.expect("Can not start server on given IP/Port")
.start();
println!("Started http server: 127.0.0.1:8080");
let _ = sys.run();
println!("Started http server: 127.0.0.1:8080");
let _ = sys.run();
}