-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.js
33 lines (28 loc) · 851 Bytes
/
app.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
var async = require('async')
var merge = require('lodash.merge')
var get = require('lodash.get')
var debug = require('debug')('systemic-express:app')
module.exports = function(options) {
var express = get(options, 'express') || require('express')
var config
var logger
function init(dependencies, cb) {
config = merge({
settings: { 'x-powered-by': false, 'etag': false }
}, dependencies.config)
logger = dependencies.logger || console
cb()
}
function start(cb) {
var app = express()
app.locals.logger = logger
for (var key in config.settings) {
debug('Setting %s to %s', key, config.settings[key])
app.set(key, config.settings[key])
}
cb(null, app)
}
return {
start: async.seq(init, start)
}
}