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'
|
|
|
|
winston = require 'winston'
|
|
|
|
serverSetup = require './server_setup'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
module.exports.startServer = ->
|
2014-01-27 18:36:35 -05:00
|
|
|
app = createAndConfigureApp()
|
2014-01-03 13:32:13 -05:00
|
|
|
http.createServer(app).listen(app.get('port'))
|
|
|
|
winston.info("Express SSL server listening on port " + app.get('port'))
|
|
|
|
return app
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|