mirror of
https://github.com/20kaushik02/spotify-manager.git
synced 2026-01-25 06:04:05 +00:00
improved API request wrapper, partial completion of operations
This commit is contained in:
@@ -6,8 +6,7 @@ import { getNestedValuesString } from "../utils/jsonTransformer.ts";
|
||||
|
||||
import logger from "../utils/logger.ts";
|
||||
|
||||
/** Refer: https://stackoverflow.com/questions/58848625/access-messages-in-express-validator */
|
||||
export const validate: RequestHandler = (req, res, next) => {
|
||||
const validate: RequestHandler = (req, res, next) => {
|
||||
const errors = validationResult(req);
|
||||
if (errors.isEmpty()) {
|
||||
return next();
|
||||
@@ -35,3 +34,5 @@ export const validate: RequestHandler = (req, res, next) => {
|
||||
logger.warn("invalid request", { extractedErrors });
|
||||
return null;
|
||||
};
|
||||
|
||||
export { validate };
|
||||
|
||||
Reference in New Issue
Block a user