Use std::fs over actix-files

This commit is contained in:
spikecodes 2020-11-18 16:31:46 -08:00
parent 4f379754f7
commit f455e2095d
8 changed files with 11 additions and 74 deletions

View file

@ -1,6 +1,6 @@
// Import Crates
use actix_files::NamedFile;
use actix_web::{get, App, HttpResponse, HttpServer, Result};
use actix_web::{get, App, HttpResponse, HttpServer};
use std::fs;
// Reference local files
mod popular;
@ -10,9 +10,9 @@ mod user;
// Create Services
#[get("/style.css")]
async fn style() -> Result<NamedFile> {
let file = NamedFile::open("static/style.css");
Ok(file?)
async fn style() -> HttpResponse {
let file = fs::read_to_string("static/style.css").expect("ERROR: Could not read style.css");
HttpResponse::Ok().body(file)
}
#[get("/favicon.ico")]