changed the url to /feed/ and reject everything else
This commit is contained in:
parent
636a02d04d
commit
0a587fb804
30
server.js
30
server.js
@ -151,7 +151,35 @@ function getUrl (req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
app.get('/:encoded_id', getUrl);
|
||||
function notFound(request, response) {
|
||||
logger.warn(
|
||||
'Unhandled resource',
|
||||
{
|
||||
'statusCode': 404,
|
||||
'error': 'Unknown resource',
|
||||
'resource': request.originalUrl
|
||||
}
|
||||
);
|
||||
|
||||
return response
|
||||
.status(404);
|
||||
}
|
||||
|
||||
function defaultErrorHandler(error, request, response, next) {
|
||||
logger.error('Uncaught error', { 'statusCode': 500, error });
|
||||
|
||||
return response
|
||||
.status(500)
|
||||
.render('pages/error');
|
||||
}
|
||||
|
||||
app.get('/feed/:encoded_id', getUrl);
|
||||
|
||||
// Mount 404 handler as penultimate middleware
|
||||
// app.use(notFoundHandler);
|
||||
|
||||
// Final middleware is our catch-all error handler
|
||||
app.use(defaultErrorHandler);
|
||||
|
||||
const server = app.listen(port, () => {
|
||||
logger.info(`Server listening on port ${port}`);
|
||||
|
Loading…
Reference in New Issue
Block a user