Last active
October 13, 2015 11:08
-
-
Save oeeckhoutte/4186702 to your computer and use it in GitHub Desktop.
[Node] Simple Node.js Server using Express < 3.0
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 app = module.exports = express.createServer(); | |
// Configuration | |
app.configure(function(){ | |
app.use(express.bodyParser()); | |
app.use(express.methodOverride()); | |
app.use(express.cookieParser()); | |
app.use(express.session({ secret: 'your secret here' })); | |
app.use(express.static('../www')); | |
}); | |
app.configure('development', function(){ | |
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); | |
}); | |
app.configure('production', function(){ | |
app.use(express.errorHandler()); | |
}); | |
app.listen(3000); | |
console.log("Express server listening on port 3000"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment