pub(crate) async fn reply_404(assets: &Assets, method: &Method, path: &str) -> Response {
    debug!("Responding with 404 to {:?} '{}'", method, path);

    // We simply send the normal index and let the frontend router determinate
    // this is a 404. That way, our 404 page looks like the main page and users
    // are not confused. And it's easier to return to the normal page.
    //
    // TODO: I am somewhat uneasy about this code assuming the router of the
    // frontend is the same as the backend router. Maybe we want to indicate to
    // the frontend explicitly to show a 404 page? However, without redirecting
    // to like `/404` because that's annoying for users.
    let html = assets.index().await;
    Response::builder()
        .status(StatusCode::NOT_FOUND)
        .header("Content-Type", "text/html; charset=UTF-8")
        .body(html)
        .unwrap()
}
/// Replies with a 404 Not Found.
Replies with a 404 Not Found.
Replies with a 404 Not Found .
pub(crate) async fn reply_404(assets: &Assets, method: &Method, path: &str) -> Response {
    debug!("Responding with 404 to {:?} '{}'", method, path);
    // We simply send the normal index and let the frontend router determinate
    // this is a 404. That way, our 404 page looks like the main page and users
    // are not confused. And it's easier to return to the normal page.
    //
    // TODO: I am somewhat uneasy about this code assuming the router of the
    // frontend is the same as the backend router. Maybe we want to indicate to
    // the frontend explicitly to show a 404 page? However, without redirecting
    // to like `/404` because that's annoying for users.
    let html = assets.index().await;
    Response::builder()
        .status(StatusCode::NOT_FOUND)
        .header("Content-Type", "text/html; charset=UTF-8")
        .body(html)
        .unwrap()
}
pub ( crate ) async fn reply_404 ( assets : & Assets , method : & Method , path : & str ) -> Response { debug ! ( " " method path ) ; // We simply send the normal index and let the frontend router determinate // this is a 404. That way, our 404 page looks like the main page and users // are not confused. And it's easier to return to the normal page. // // TODO: I am somewhat uneasy about this code assuming the router of the // frontend is the same as the backend router. Maybe we want to indicate to // the frontend explicitly to show a 404 page? However, without redirecting // to like `/404` because that's annoying for users. let html = assets . index ( ) . await ; Response :: builder ( ) . status ( StatusCode :: NOT_FOUND ) . header ( " " , " " ) . body ( html ) . unwrap ( ) }
Replies with a 404 Not Found.
Replies with a 404 Not Found .
assets
&Assets
method
&Method
path
&str