Skip to content

Instantly share code, notes, and snippets.

@joshsmith
Created December 2, 2011 02:24
Show Gist options
  • Save joshsmith/1421433 to your computer and use it in GitHub Desktop.
Save joshsmith/1421433 to your computer and use it in GitHub Desktop.
/**
* Module dependencies.
*/
var express = require('express');
// Create the server
app = express.createServer();
// Require the routes
var routes = require('./routes')
// Set up everyauth
var everyauth = require('everyauth')
, Promise = everyauth.Promise;
everyauth.debug = true;
// Require config
var conf = require('./config/conf');
var graph = require('fbgraph');
// Configure dev environment
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
app.set('db', 'tcp://postgres:1234@localhost/wadsup');
app.set('app_host', 'http://localhost:3000');
// Set Facebook settings
app.set('fb_host', 'http://localhost:3000');
app.set('fbAppId', conf.fb_dev.appId);
app.set('fbAppSecret', conf.fb_dev.appSecret);
});
// Configure prod environment
app.configure('production', function(){
app.use(express.errorHandler());
app.set('db', 'tcp://postgres:[email protected]/wadsup');
app.set('app_host', 'http://wadsup.nodejitsu.com');
// Set Facebook settings
app.set('fb_host', 'http://wadsup.nodejitsu.com');
app.set('fbAppId', conf.fb.appId);
app.set('fbAppSecret', conf.fb.appSecret);
});
// Require the authentication
require('./everyauth');
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session({ secret: 'esoognom' }));
app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] }));
app.use(express.static(__dirname + '/public'));
app.use(everyauth.middleware());
});
// Routes
app.get('/', routes.index);
app.get('/places', routes.places);
app.post('/facebook/:operation?', routes.facebook);
var port = process.env.PORT || 3000; // Set the port for Heroku/dev
app.listen(port);
module.exports = app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment