UC done v1.0
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
const { sendResponse } = require('../helpers/responseHelper');
|
||||
const {httpStatus, httpStatusMessages} = require('../helpers/httpResponses')
|
||||
function apiKeyValidation(req, res, next) {
|
||||
const apiKey = req.headers['x-api-key'];
|
||||
|
||||
if (apiKey !== req.app.locals.apiKey) {
|
||||
return sendResponse(res, httpStatus.UNAUTHORIZED, httpStatusMessages[httpStatus.UNAUTHORIZED]);
|
||||
}
|
||||
next();
|
||||
}
|
||||
|
||||
module.exports = apiKeyValidation;
|
||||
Reference in New Issue
Block a user