2015-12-02 14:16:20 -05:00
|
|
|
require 'newrelic' if process.env.NEW_RELIC_LICENSE_KEY?
|
|
|
|
|
2014-01-27 18:36:35 -05:00
|
|
|
do (setupLodash = this) ->
|
|
|
|
GLOBAL._ = require 'lodash'
|
|
|
|
_.str = require 'underscore.string'
|
|
|
|
_.mixin _.str.exports()
|
|
|
|
|
|
|
|
express = require 'express'
|
|
|
|
http = require 'http'
|
2014-02-04 17:08:20 -05:00
|
|
|
log = require 'winston'
|
2014-01-27 18:36:35 -05:00
|
|
|
serverSetup = require './server_setup'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2015-12-09 17:27:10 -05:00
|
|
|
module.exports.startServer = (done) ->
|
2014-01-27 18:36:35 -05:00
|
|
|
app = createAndConfigureApp()
|
2015-12-09 17:27:10 -05:00
|
|
|
http.createServer(app).listen app.get('port'), -> done?()
|
2014-06-30 22:16:26 -04:00
|
|
|
log.info('Express SSL server listening on port ' + app.get('port'))
|
2014-06-22 18:10:40 -04:00
|
|
|
app
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-01-27 18:36:35 -05:00
|
|
|
createAndConfigureApp = ->
|
|
|
|
serverSetup.setupLogging()
|
|
|
|
serverSetup.connectToDatabase()
|
|
|
|
serverSetup.setupMailchimp()
|
|
|
|
|
|
|
|
app = express()
|
|
|
|
serverSetup.setExpressConfigurationOptions app
|
|
|
|
serverSetup.setupMiddleware app
|
|
|
|
serverSetup.setupRoutes app
|
|
|
|
app
|