mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
add express-validator, add body parser middleware, support some more errors in error handler middleware
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
// This module is only used to attach middlewares to the express app
|
||||
|
||||
import errorHandler from './errorHandler';
|
||||
import bodyParser from 'body-parser';
|
||||
|
||||
export default function attachMiddlewares (app) {
|
||||
|
||||
// Parse query parameters and json bodies
|
||||
// TODO handle errors
|
||||
app.use(bodyParser.urlencoded(
|
||||
extended: true, // Uses 'qs' library as old connect middleware
|
||||
}));
|
||||
app.use(bodyParser.json());
|
||||
|
||||
// Error handler middleware, define as the last one
|
||||
app.use(errorHandler);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user