Split index file into src/ folder components

This commit is contained in:
2022-10-14 20:23:13 +02:00
parent 497037ad20
commit 9e9624821e
8 changed files with 111 additions and 78 deletions

View File

@@ -0,0 +1,14 @@
const { MissingTextError } = require("./errors.js");
const requiredQueryMiddleware = (req, res, next) => {
const { text } = req.query;
if (!text || text?.length === 0) {
const error = new MissingTextError();
return res.status(error?.statusCode || 500).send(error?.message);
}
next();
};
module.exports = requiredQueryMiddleware;