mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
27 lines
741 B
CoffeeScript
27 lines
741 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 = (port, path, callback) ->
|
|
app = createAndConfigureApp()
|
|
port = port or app.get('port')
|
|
server = http.createServer(app).listen(port, callback)
|
|
log.info('Express SSL server listening on port ' + port)
|
|
server
|
|
|
|
createAndConfigureApp = ->
|
|
serverSetup.setupLogging()
|
|
serverSetup.connectToDatabase()
|
|
serverSetup.setupMailchimp()
|
|
|
|
app = express()
|
|
serverSetup.setExpressConfigurationOptions app
|
|
serverSetup.setupMiddleware app
|
|
serverSetup.setupRoutes app
|
|
app
|