From 57a341781b2f35bc257b4261b4d20a98412d6de9 Mon Sep 17 00:00:00 2001 From: Kin Leon Zinzombe <125105023+zinzombe-kin@users.noreply.github.com> Date: Tue, 28 Mar 2023 03:24:22 +0200 Subject: [PATCH] Update server.js --- server/server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/server.js b/server/server.js index de8b931..f3ce6f3 100644 --- a/server/server.js +++ b/server/server.js @@ -1,4 +1,4 @@ -// Packages +// Dependencies const expressValidator = require("express-validator"); const express = require("express"); require("express-async-errors"); @@ -15,7 +15,7 @@ const runSeed = require("./seeds"); dbConnection(); runSeed(); -// Middlewares +// Middlewares] logger(app); app.use(cors()); app.use(express.json()); @@ -39,7 +39,7 @@ app.use("/api/travels", require("./routes/travel")); app.use("/api/users", require("./routes/user")); // Error handling middleware -app.use(function (err, req, res, next) { +app.use(() => (err, req, res, next) { return res.status(500).json({ error: errorHandler(err) || "Something went wrong!", });