From: Brendan Hansen Date: Tue, 2 May 2023 03:25:56 +0000 (-0500) Subject: added: 404 to bad pages X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=29632656de8e2df9f4c2f98de298eb190c8c62b5;p=onyxlang.io.git added: 404 to bad pages --- diff --git a/src/app.onyx b/src/app.onyx index ec3d3c3..fb9c79d 100644 --- a/src/app.onyx +++ b/src/app.onyx @@ -43,7 +43,11 @@ news_articles: Cached_Resource([] Article); @route.{.GET, "/news/:article"} (req: &Req, res: &Res) { article := array.first(news_articles->get() ?? .[], #(it.path == req.url_params["article"])); - if !article do return; + if !article { + res->status(404); + res->render("pages/404", null); + return; + } filename := tprintf("www/news-articles/{}.html", article.path);