Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (29 sloc) 1.07 KB
express = require "express"
mongoose = require "mongoose"
app = module.exports = express.createServer()
app.configure "development", ->
app.use express.logger "dev"
app.use express.errorHandler dumpExceptions: true, showStack:true
app.configure ->
app.set "views", "#{__dirname}/views"
app.set "view engine", "jade"
app.set "view options", layout:false
app.use express.bodyParser()
app.use express.methodOverride()
app.use app.router
app.use require("connect-assets")()
app.use express.static "#{__dirname}/public"
express.errorHandler.title = "Quizzical Empire Online"
app.configure "production", ->
app.use express.errorHandler()
# Let the routes configure the app:
app.listen process.env.PORT || 3000
dburl = process.env.MONGOLAB_URI || "mongodb://localhost/quizzical-empire"
console.log "Connecting to #{dburl} ..."
mongoose.connect dburl, (err) ->
if err
console.log "Connection errors: #{err}"
throw err
console.log "Quizzical Empire: Express server listening on port %d in %s mode",
app.address().port, app.settings.env
Something went wrong with that request. Please try again.