From 29632656de8e2df9f4c2f98de298eb190c8c62b5 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Mon, 1 May 2023 22:25:56 -0500 Subject: [PATCH] added: 404 to bad pages --- src/app.onyx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 2.25.1