Basic static file server with actix-web
| extern crate actix_web; | |
| use actix_web::{fs, server, App}; | |
| fn main() { | |
| server::new(|| { | |
| App::new() | |
| .handler( | |
| "/", | |
| fs::StaticFiles::new("./public") | |
| .unwrap() | |
| .show_files_listing(), | |
| ) | |
| .finish() | |
| }) | |
| .workers(1) | |
| .bind("127.0.0.1:8000") | |
| .expect("Can not bind to port 8000") | |
| .run(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment