Skip to content

Instantly share code, notes, and snippets.

@codesections
Created December 20, 2018 22:03
Show Gist options
  • Save codesections/cccbd299f11e16e4e9c9fb53101b1ced to your computer and use it in GitHub Desktop.
Save codesections/cccbd299f11e16e4e9c9fb53101b1ced to your computer and use it in GitHub Desktop.
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