Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. var basicAuth = require('basic-auth'),
  2. auth = function (req, res, next) {
  3. var user = basicAuth(req);
  4. if (user && user.name === "user" && user.pass === "password") return next();
  5. res.set('WWW-Authenticate', 'Basic realm=Authorization Required');
  6. return res.send(401);
  7. };
  8.  
  9. module.exports.http = {
  10.  
  11. customMiddleware: function (app) {
  12. app.use('/', auth);
  13. },
  14.  
  15. if (sails.config.environment === 'staging') {}
  16.  
  17. if (sails.config.environment === 'staging') {
  18. ^
  19.  
  20. ReferenceError: sails is not defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement