challenge.js
basic-checks.md
JavaScript
Authentication & cryptography
Difficulty 1/3
1
function
requireApiKey(req, res, next) {
2
if
(req.headers[
"x-api-key"
] == process.env.API_KEY) {
3
return
next();
4
}
5
res.status(
401
).end();
6
}