Guest User

Untitled

a guest
Jan 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. app.use(authUtil.checkAuth, express.static(config.root + '/public'));
  2.  
  3. app.use('/', function(req, res, next){
  4.  
  5. });
  6.  
  7. app.use(express.static(path.join(root, 'public')));
  8.  
  9. // Auth middleware
  10.  
  11. const checkAuth = function (req, res, next) {
  12. if (req.method !== 'GET' && req.method !== 'HEAD') {
  13. return next();
  14. }
  15.  
  16. // Parse the url and check if it's a static request
  17. // Not sure what to check for exactly - perhaps if it's not `/api` or something
  18. }
  19.  
  20. // Middleware has to be set in correct order
  21. app.use(checkAuth)
  22. app.use(express.static(config.root + '/public'));
  23.  
  24. app.all(/(?!/api)/, checkAuth)
Add Comment
Please, Sign In to add comment