-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathserver.js
More file actions
39 lines (35 loc) · 853 Bytes
/
server.js
File metadata and controls
39 lines (35 loc) · 853 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
var prerender = require('./lib');
var _ = require('lodash');
var defaultConfig = {
port: 3000,
phantomPort: 30000,
processNum: 0,
engine: 'jsdom',
initializeTimeout: 25000,
renderTimeout: 15000,
maxRequestsPerRenderer: 100,
maxQueueSize: 1000,
baseUrl: 'http://localhost/',
assetsPath: process.cwd() + '/public/',
applicationPage: 'index.html',
serveFiles: true,
filesMatch: /\.(?:css|js|jpg|png|gif|ico|svg|woff|ttf|swf)(?:\?|$)/,
logging: {
level: 'debug',
timestamp: true,
format: true
},
plugins: [
'removeScriptTags',
'httpHeaders'
]
};
if (process.env.CONFIG) {
config = require(process.env.CONFIG)
_.merge(defaultConfig, config);
}
if (process.env.PROCESS_NUM) {
defaultConfig.processNum = parseInt(process.env.PROCESS_NUM);
}
var server = prerender(defaultConfig);
server.start();