-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.js
109 lines (95 loc) · 2.49 KB
/
web.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
'use strict'
/**
* Server Configuration
* (app.config.web)
*
* Configure the Web Server
*
* @see {@link http://trailsjs.io/doc/config/web}
*/
module.exports = {
express: require('express'),
/**
* CORS options
* Can be true/false or an object of CORS options
* @see {@link https://github.com/expressjs/cors#configuring-cors}
*/
cors: false,
/**
* Middlewares to load (in order)
*/
middlewares: {
//middlewares loading order
order: [
'addMethods',
'cookieParser',
'session',
'passportInit',
'passportSession',
'bodyParser',
'methodOverride',
'router',
'www',
'404',
'500'
]
/**
* Middlewares to load for body parsing
bodyParser: [
bodyParser.json(),
bodyParser.urlencoded({extended: false})
]
*/
},
/***************************************************************************
* *
* The number of seconds to cache flat files on disk being served by *
* Express static middleware (by default, these files are in `.tmp/public`) *
* *
* The HTTP static cache is only active in a 'production' environment, *
* since that's the only time Express will cache flat-files. *
* *
***************************************************************************/
cache: 31557600000,
/**
* The host to bind the web server to
*/
//host: process.env.HOST || 'localhost',
/**
* The port to bind the web server to
*/
port: process.env.PORT || 3000
/**
* Alternate method to add multiple template engine, for single view template use config.view.engine
*/
/*
views: {
engines: {
// html: require('some-view-engine')
},
path: 'views'
},
*/
/**
* SSL options
* Cert and key or pfx to create HTTPS server
*/
/*
ssl: {
key: fs.readFileSync('path/to/private.key'),
cert: fs.readFileSync('path/to/certificate.pem')
//OR pfx: fs.readFileSync('path/to/server.pfx')
},
*/
/**
* Automatically redirect HTTP to HTTPS
* Create an HTTP server who redirect to HTTPS server
* Work only if SSL is enabled
*/
//redirectToHttps: false,
/**
* Http port to use if you want to enable http and https
* SSL need to be enabled
*/
//portHttp: 80
}