Serve static files from ./public

This commit is contained in:
Valentin Brandl 2019-07-27 20:25:25 +02:00
parent 1857aa43bb
commit 242456d943
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D

View File

@ -19,6 +19,7 @@ use crate::{
service::{Bitbucket, GitLab, Github, Service}, service::{Bitbucket, GitLab, Github, Service},
statics::{FAVICON, OPT}, statics::{FAVICON, OPT},
}; };
use actix_files;
use actix_web::{ use actix_web::{
http::header::{self, CacheControl, CacheDirective}, http::header::{self, CacheControl, CacheDirective},
middleware, web, App, Error, HttpResponse, HttpServer, middleware, web, App, Error, HttpResponse, HttpServer,
@ -115,6 +116,7 @@ fn main() -> Result<()> {
"/gitlab/{user}/{repo}/{commit}/{file:.*}", "/gitlab/{user}/{repo}/{commit}/{file:.*}",
web::get().to_async(handle_request::<GitLab>), web::get().to_async(handle_request::<GitLab>),
) )
.service(actix_files::Files::new("/", "public").index_file("index.html"))
}) })
.workers(OPT.workers) .workers(OPT.workers)
.bind((OPT.interface, OPT.port))? .bind((OPT.interface, OPT.port))?