mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-14 11:06:55 -04:00
allow for 404 files and be graceful if one doesnt exist
This commit is contained in:
parent
a5fb1e33de
commit
2affccf900
1 changed files with 11 additions and 0 deletions
|
@ -80,5 +80,16 @@ exports.restartServer = function () {
|
|||
});
|
||||
hooks.callAll("expressCreateServer", {"app": app, "server": server});
|
||||
|
||||
//The 404 Route (ALWAYS Keep this as the last route)
|
||||
app.get('*', function(req, res){
|
||||
var rootPath = path.resolve(npm.dir, '..');
|
||||
var customFile = rootPath + '/src/static/custom/404.html';
|
||||
if(fs.existsSync(customFile)){ // if a custom 404 page exists..
|
||||
res.sendfile(customFile);
|
||||
} else {
|
||||
res.send('Resource does not exist', 404);
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(settings.port, settings.ip);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue