forked from javascript-tutorial/server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandlers.js
More file actions
executable file
·45 lines (33 loc) · 990 Bytes
/
handlers.js
File metadata and controls
executable file
·45 lines (33 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'use strict';
const path = require('path');
const fs = require('fs');
var handlers = [
'mongooseHandler',
'requestId',
'requestLog',
'nocache',
// this middleware adds this.render method
// it is *before errorHandler*, because errors need this.render
'render',
// errors wrap everything
'errorHandler',
// this logger only logs HTTP status and URL
// before everything to make sure it log all
'accessLogger',
// pure node.js examples from tutorial
// before session
// before form parsing, csrf checking or whatever, bare node
'nodeExample',
// before anything that may deal with body
// it parses JSON & URLENCODED FORMS,
// it does not parse form/multipart
'bodyParser',
// parse FORM/MULTIPART
// (many tweaks possible, lets the middleware decide how to parse it)
'multipartParser',
// right after parsing body, make sure we logged for development
'verboseLogger',
'conditional',
'tutorial'
];
module.exports = handlers;