aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMarvin Borner2019-01-24 17:29:02 +0100
committerMarvin Borner2019-01-24 17:29:02 +0100
commit2abf58c832112e6ef950bbd6a7616eac22ac4b10 (patch)
tree55f3d4f6c542e2ecb8da0ee832dc7ba2a2569862 /src
parent5abc62e8657e70c405afa175e52c73316d8a53a2 (diff)
Reformatted code
Diffstat (limited to 'src')
-rw-r--r--src/app.js18
-rw-r--r--src/routes.js22
2 files changed, 20 insertions, 20 deletions
diff --git a/src/app.js b/src/app.js
index 2770943..0b0b3cd 100644
--- a/src/app.js
+++ b/src/app.js
@@ -12,7 +12,7 @@ app.set('views', path.join(__dirname, '../views'));
app.set('view engine', 'pug');
app.use(logger('dev', {
- skip: () => app.get('env') === 'test'
+ skip: () => app.get('env') === 'test'
}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
@@ -23,18 +23,18 @@ app.use('/', routes);
// Catch 404 and forward to error handler
app.use((req, res, next) => {
- const err = new Error('Not Found');
- err.status = 404;
- next(err);
+ const err = new Error('Not Found');
+ err.status = 404;
+ next(err);
});
// Error handler
app.use((err, req, res, next) => { // eslint-disable-line no-unused-vars
- res
- .status(err.status || 500)
- .render('error', {
- message: err.message
- });
+ res
+ .status(err.status || 500)
+ .render('error', {
+ message: err.message
+ });
});
export default app;
diff --git a/src/routes.js b/src/routes.js
index cecb5d0..c6590da 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -6,7 +6,7 @@ const routes = Router();
* GET home page
*/
routes.get('/', (req, res) => {
- res.render('index');
+ res.render('index');
});
/**
@@ -19,18 +19,18 @@ routes.get('/', (req, res) => {
* your use case.
*/
routes.get('/list', (req, res, next) => {
- const {title} = req.query;
+ const {title} = req.query;
- if (title == null || title === '') {
- // You probably want to set the response HTTP status to 400 Bad Request
- // or 422 Unprocessable Entity instead of the default 500 of
- // the global error handler (e.g check out https://github.com/kbariotis/throw.js).
- // This is just for demo purposes.
- next(new Error('The "title" parameter is required'));
- return;
- }
+ if (title == null || title === '') {
+ // You probably want to set the response HTTP status to 400 Bad Request
+ // or 422 Unprocessable Entity instead of the default 500 of
+ // the global error handler (e.g check out https://github.com/kbariotis/throw.js).
+ // This is just for demo purposes.
+ next(new Error('The "title" parameter is required'));
+ return;
+ }
- res.render('index', {title});
+ res.render('index', {title});
});
export default routes;