fix for exception raised when public directory does not exist
This commit is contained in:
parent
6766f53248
commit
45230dc112
14
index.js
14
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.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));
|
||||||
|
|
||||||
if (fs.statSync('public').isDirectory()) {
|
try {
|
||||||
app.use(express.static('public', {
|
if (fs.statSync('public').isDirectory()) {
|
||||||
fallthrough: false,
|
app.use(express.static('public', {
|
||||||
maxAge: 0,
|
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 };
|
var config = { port: process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765 };
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue