diff --git a/examples/web-service/index.js b/examples/web-service/index.js index c22fea4032..a2cd2cb7f9 100644 --- a/examples/web-service/index.js +++ b/examples/web-service/index.js @@ -34,7 +34,7 @@ app.use('/api', function(req, res, next){ if (!key) return next(error(400, 'api key required')); // key is invalid - if (!~apiKeys.indexOf(key)) return next(error(401, 'invalid api key')); + if (apiKeys.indexOf(key) === -1) return next(error(401, 'invalid api key')) // all good, store req.key for route access req.key = key;