|
|
|
@ -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)?
|
|
|
|
|