Created
April 24, 2013 19:49
-
-
Save zachariahtimothy/5455017 to your computer and use it in GitHub Desktop.
Express as an API application exported for interoperability with Grunt.
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
/** | |
* 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