mirror of
https://github.com/SinTan1729/chhoto-url
synced 2024-12-26 07:38:36 -06:00
fix: Handle most wrong routes
This commit is contained in:
parent
1c91855820
commit
e3520be75b
1 changed files with 2 additions and 3 deletions
|
@ -58,7 +58,6 @@ async fn siteurl(session: Session) -> HttpResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 404 error page
|
// 404 error page
|
||||||
#[get("/err/404")]
|
|
||||||
async fn error404() -> impl Responder {
|
async fn error404() -> impl Responder {
|
||||||
NamedFile::open_async("./resources/static/404.html")
|
NamedFile::open_async("./resources/static/404.html")
|
||||||
.await
|
.await
|
||||||
|
@ -139,13 +138,13 @@ async fn main() -> std::io::Result<()> {
|
||||||
.wrap(middleware::Logger::default())
|
.wrap(middleware::Logger::default())
|
||||||
.wrap(middleware::Compress::default())
|
.wrap(middleware::Compress::default())
|
||||||
.service(link_handler)
|
.service(link_handler)
|
||||||
.service(error404)
|
|
||||||
.service(getall)
|
.service(getall)
|
||||||
.service(siteurl)
|
.service(siteurl)
|
||||||
.service(add_link)
|
.service(add_link)
|
||||||
.service(delete_link)
|
.service(delete_link)
|
||||||
.service(login)
|
.service(login)
|
||||||
.default_service(Files::new("/", "./resources/").index_file("index.html"))
|
.service(Files::new("/", "./resources/").index_file("index.html"))
|
||||||
|
.default_service(web::get().to(error404))
|
||||||
})
|
})
|
||||||
.bind(("0.0.0.0", port))?
|
.bind(("0.0.0.0", port))?
|
||||||
.run()
|
.run()
|
||||||
|
|
Loading…
Reference in a new issue