chore(deps): upgrade to Express 5 and remove redundant middleware
- Express 4 → 5.2.1 - Remove method-override (unused with Angular HttpClient) and errorhandler (superseded by exceptions.handler.js) - Remove asyncHandler wrapper from all controllers — Express 5 propagates async rejections natively - Remove body-parser (redundant, Express 5 includes it internally) - Patch/minor updates: cors, dotenv, ejs, express-jwt, express-session, jsonwebtoken, morgan, mysql2, sequelize, underscore - Dev updates: eslint 9.0→9.39, nodemon 2→3, globals, sequelize-cli - Fix getUser endpoint to include SkydiverProfile data in response - docs: add ADR 0013, update README
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
const { CommentService } = require('../services');
|
||||
const asyncHandler = require("../middlewares/asyncHandler");
|
||||
const ErrorResponse = require("../utils/errorResponse");
|
||||
|
||||
module.exports.createComment = asyncHandler(async (req, res, next) => {
|
||||
module.exports.createComment = async (req, res, next) => {
|
||||
try {
|
||||
const { slug, title, description, body } = req.body;
|
||||
const comment = await CommentService.createComment({
|
||||
@@ -20,9 +19,9 @@ module.exports.createComment = asyncHandler(async (req, res, next) => {
|
||||
} catch (err) {
|
||||
return next(new ErrorResponse('Something went wrong while creating comment.', 500, err.message));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.getAllComments = asyncHandler(async (req, res, next) => {
|
||||
module.exports.getAllComments = async (req, res, next) => {
|
||||
try {
|
||||
const comments = await CommentService.getAllComments();
|
||||
|
||||
@@ -32,4 +31,4 @@ module.exports.getAllComments = asyncHandler(async (req, res, next) => {
|
||||
} catch (err) {
|
||||
return next(new ErrorResponse('Something went wrong while fetching comments.', 500, err.message));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user