Skip to content

Commit

Permalink
Add basic auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Matenaar committed Oct 13, 2015
1 parent 7a58a3b commit fa00d65
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions routes/middleware/basic_auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const restify = require('restify');

module.exports = (req, res, next) => {
if (!req.authorization.basic || req.authorization.basic.password !== process.env.API_KEY) {
return next(new restify.UnauthorizedError);
}

return next();
};

0 comments on commit fa00d65

Please sign in to comment.