adds server to serve the static files, fixes db tables

This commit is contained in:
2019-06-18 15:44:49 +02:00
parent ef9124cc74
commit 9b3df58a08
9 changed files with 44 additions and 19 deletions

View File

@@ -1,5 +1,25 @@
extern crate lootalot_db;
extern crate actix_web;
extern crate dotenv;
use std::env;
use std::cell::RefCell;
use std::rc::Rc;
use actix_web::{server, App, Result, HttpRequest, fs };
fn main() {
println!("Hello, world!");
dotenv::dotenv().ok();
let www_root: String = env::var("WWW_ROOT").expect("WWW_ROOT must be set");
println!("serving files from: {}", &www_root);
server::new(move || {
App::new()
.handler("/", fs::StaticFiles::new(www_root.clone()).unwrap().index_file("index.html"))
})
.bind("127.0.0.1:8088")
.unwrap()
.run();
}