Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.use(authUtil.checkAuth, express.static(config.root + '/public'));
- app.use('/', function(req, res, next){
- });
- app.use(express.static(path.join(root, 'public')));
- // Auth middleware
- const checkAuth = function (req, res, next) {
- if (req.method !== 'GET' && req.method !== 'HEAD') {
- return next();
- }
- // Parse the url and check if it's a static request
- // Not sure what to check for exactly - perhaps if it's not `/api` or something
- }
- // Middleware has to be set in correct order
- app.use(checkAuth)
- app.use(express.static(config.root + '/public'));
- app.all(/(?!/api)/, checkAuth)
Add Comment
Please, Sign In to add comment