codecombat/server.coffee
Michael Schmatz 177eb60e48 Merge pull request #342 from codecombat/master
Merge server refactor into task queue
2014-02-05 09:38:18 -08:00

27 lines
693 B
CoffeeScript

do (setupLodash = this) ->
GLOBAL._ = require 'lodash'
_.str = require 'underscore.string'
_.mixin _.str.exports()
express = require 'express'
http = require 'http'
log = require 'winston'
serverSetup = require './server_setup'
module.exports.startServer = ->
app = createAndConfigureApp()
http.createServer(app).listen(app.get('port'))
log.info("Express SSL server listening on port " + app.get('port'))
return app
createAndConfigureApp = ->
serverSetup.setupLogging()
serverSetup.connectToDatabase()
serverSetup.setupMailchimp()
app = express()
serverSetup.setExpressConfigurationOptions app
serverSetup.setupMiddleware app
serverSetup.setupRoutes app
app