Implement robots.txt

This commit is contained in:
spikecodes 2020-11-20 19:33:38 -08:00
parent 4dbb5367e7
commit 0340e834a6
1 changed files with 7 additions and 0 deletions

View File

@ -15,6 +15,12 @@ async fn style() -> HttpResponse {
HttpResponse::Ok().content_type("text/css").body(file)
}
#[get("/robots.txt")]
async fn robots() -> HttpResponse {
let file = fs::read_to_string("static/robots.txt").expect("ERROR: Could not read robots.txt");
HttpResponse::Ok().body(file)
}
#[get("/favicon.ico")]
async fn favicon() -> HttpResponse {
HttpResponse::Ok().body("")
@ -30,6 +36,7 @@ async fn main() -> std::io::Result<()> {
// GENERAL SERVICES
.service(style)
.service(favicon)
.service(robots)
// POST SERVICES
.service(post::short)
.service(post::page)