Fix checking if API is enabled

This commit is contained in:
Justin Reynolds 2019-08-06 21:14:33 -05:00
parent cf9ad221f8
commit 7a60eef375

View file

@ -946,8 +946,8 @@ if (Meteor.isServer) {
if (Meteor.isServer) {
// Middleware which checks that API is enabled.
JsonRoutes.Middleware.use(function(req, res, next) {
const api = req.url.search('api');
if ((api === 1 && process.env.WITH_API === 'true') || api === -1) {
const api = req.url.startsWith('/api');
if ((api === true && process.env.WITH_API === 'true') || api === false) {
return next();
} else {
res.writeHead(301, { Location: '/' });