Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Express as an API application exported for interoperability with Grunt.
/**
* Module dependencies.
*/
var express = require('express');
var http = require('http');
var app = express();
// all environments
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.cookieSession({secret: 'cool cat', maxAge: 60 * 60 * 1000}));
app.use(app.router);
// development only
if ('development' === app.get('env')) {
app.use(express.errorHandler());
}
app.get('/', function (req, res) {
res.sendfile('app/index.html');
});
require('./routes')(app);
exports = module.exports = http.createServer(app);
exports.use = function() {
app.use.apply(app, arguments);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment