1
我有以下设置的API VERSION1将通过中间件验证令牌的NodeJS - 设置不同的API版本
var app = express();
// Auth Middleware - This will check if the token is valid
// Only the requests that start with /api/version1/* will be checked for the token.
// Any URL's that do not follow the below pattern should be avoided unless you
// are sure that authentication is not needed
app.all('/api/version1/*', [require('./middleWare/validateMyRequest')]);
app.use('/', require('./myModal'));
app.all('/*', function(req, res) {
res.sendFile('/public/index.html', { root: __dirname });
});
在这里,我要设置在服务器configuation另一个API版本2中,我不需要验证令牌使用中间ware.I已尝试以下配置
app.use('/api/version2/*', require('./myModal'));
当我尝试与API版本2的baseurl。它总是验证令牌并重定向到登录页面。请告知我在这里想要设置API版本2?