diff --git a/index.js b/index.js index eb267a7..daf75e8 100644 --- a/index.js +++ b/index.js @@ -438,12 +438,14 @@ app.get('/api/:type(game|meta)/:gameId/poll/:afterTime', catchExceptionsJson(get app.get('/api/:type(game|meta)/:gameId', catchExceptionsJson(getGameHandler)); app.post('/api/:type(game|meta)/:gameId', express.json(), catchExceptionsJson(postGameHandler)); -if (fs.statSync('public').isDirectory()) { - app.use(express.static('public', { - fallthrough: false, - maxAge: 0, - })); -} +try { + if (fs.statSync('public').isDirectory()) { + app.use(express.static('public', { + fallthrough: false, + maxAge: 0, + })); + } +} catch (err) {} var config = { port: process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765 };