login WIP

This commit is contained in:
newtbot
2024-01-20 04:13:20 +08:00
parent 2ecb69c828
commit 32be41ea46
7 changed files with 141 additions and 54 deletions

View File

@ -28,12 +28,19 @@ app.use("/", require("../routes/render")); //consumerWebsite\routes\render.js
// Catch 404 and forward to error handler. If none of the above routes are
// used, this is what will be called.
app.use(function (req, res, next) {
if (req.is("application/json")) {
var err = new Error("Not Found");
err.message = "Page not found";
err.status = 404;
next(err);
}
else{
res.status(404).render("404");
}
});
// Error handler. This is where `next()` will go on error
app.use(function (err, req, res, next) {
console.error(err.status || res.status, err.name, req.method, req.url);