Fix Static File Bundling

This commit is contained in:
spikecodes 2020-11-29 13:46:53 -08:00
parent 3902a36ea3
commit 8f157c0b40
4 changed files with 16581 additions and 68 deletions

View file

@ -12,14 +12,12 @@ mod utils;
// Create Services
#[get("/style.css")]
async fn style() -> HttpResponse {
let file = std::fs::read_to_string("static/style.css").expect("ERROR: Could not read style.css");
HttpResponse::Ok().content_type("text/css").body(file)
HttpResponse::Ok().content_type("text/css").body(include_str!("../static/style.css"))
}
#[get("/robots.txt")]
async fn robots() -> HttpResponse {
let file = std::fs::read_to_string("static/robots.txt").expect("ERROR: Could not read robots.txt");
HttpResponse::Ok().body(file)
HttpResponse::Ok().body(include_str!("../static/robots.txt"))
}
#[get("/favicon.ico")]