Created
April 3, 2013 13:03
-
-
Save jbrooksuk/5301027 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
http = require('http'), | |
https = require('https'), | |
crypto = require('crypto'), | |
fs = require('fs'), | |
url = require('url'), | |
winston = require('winston'); | |
var app = express(); | |
app.listen(process.env.PORT || 3000); | |
app.configure(function() { | |
app.set('views', __dirname + '/public/views'); | |
app.set('view engine', 'jade'); | |
app.set('view options', { | |
layout: true | |
}); | |
app.use(function(req, res, next) { | |
res.locals.stripePublishable = config.stripe.publishable; | |
res.locals.copyrightYear = new Date().getFullYear(); | |
next(); | |
}); | |
app.use(express.favicon()); | |
app.use(express.logger('dev')); | |
app.use(express.bodyParser()); | |
app.use(express.methodOverride()); | |
app.use(express.cookieParser()); | |
app.use(express.session( { secret: "somekey" } )); | |
app.use(express.vhost('api.example.com', require('./lib/subdomains/api').app)); | |
app.use(app.router); | |
app.use(express.static(__dirname + '/public')); | |
}); | |
/** | |
* Import Routes. | |
* Routes require the express server, the API and the MongoDB schema to run. | |
* We don't include these on the module since we don't want to be creating a new MongoDB instance for every module. | |
*/ | |
require('./lib/routes')(app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment