Added page not found message

This commit is contained in:
Caleb Gardner
2024-01-03 04:42:08 -06:00
parent 7ea705553e
commit 77b9d8b75a
+1
View File
@@ -49,6 +49,7 @@ func (d *DarkstormTech) HandleReqest(req *stupid.Request) bool {
}
res := d.DB.Collection("pages").FindOne(context.TODO(), bson.M{"_id": strings.Join(req.Path[2:], "/")}, options.FindOne().SetProjection(bson.M{"_id": 0, "content": 1}))
if res.Err() == mongo.ErrNoDocuments {
req.Resp.Write([]byte("Page not found 😥"))
req.Resp.WriteHeader(http.StatusNotFound) //TODO: Give some sort of default page.
return true
} else if res.Err() != nil {