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
|
|
|
|
|
|
|
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'))
|
2014-02-04 17:08:20 -05:00
|
|
|
log.info("Express SSL server listening on port " + app.get('port'))
|
2014-01-03 13:32:13 -05:00
|
|
|
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
|
|
|
|
|