add 404 page
This commit is contained in:
parent
458220df47
commit
c9d00db39a
|
@ -141,6 +141,12 @@ async fn download(
|
|||
}
|
||||
}
|
||||
|
||||
async fn not_found() -> Result<HttpResponse, Error> {
|
||||
Ok(HttpResponse::NotFound()
|
||||
.content_type("text/plain")
|
||||
.body("not found"))
|
||||
}
|
||||
|
||||
fn get_db_url() -> String {
|
||||
if let Ok(database_url) = env::var("DATABASE_URL") {
|
||||
return database_url;
|
||||
|
@ -239,6 +245,7 @@ async fn main() -> std::io::Result<()> {
|
|||
.route(web::get().to(download)),
|
||||
)
|
||||
.service(Files::new("/static", "static").disable_content_disposition())
|
||||
.default_service(web::route().to(not_found))
|
||||
}
|
||||
})
|
||||
.bind(bind_address)?
|
||||
|
|
Loading…
Reference in New Issue