fix for exception raised when public directory does not exist

This commit is contained in:
Jesse D. McDonald 2020-05-02 15:45:43 -05:00
parent 6766f53248
commit 45230dc112
1 changed files with 8 additions and 6 deletions

View File

@ -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.get('/api/:type(game|meta)/:gameId', catchExceptionsJson(getGameHandler));
app.post('/api/:type(game|meta)/:gameId', express.json(), catchExceptionsJson(postGameHandler)); app.post('/api/:type(game|meta)/:gameId', express.json(), catchExceptionsJson(postGameHandler));
try {
if (fs.statSync('public').isDirectory()) { if (fs.statSync('public').isDirectory()) {
app.use(express.static('public', { app.use(express.static('public', {
fallthrough: false, fallthrough: false,
maxAge: 0, maxAge: 0,
})); }));
} }
} catch (err) {}
var config = { port: process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765 }; var config = { port: process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765 };