Skip to content

Instantly share code, notes, and snippets.

@johnsmith17th
Last active December 16, 2015 19:51
Show Gist options
  • Save johnsmith17th/5488391 to your computer and use it in GitHub Desktop.
Save johnsmith17th/5488391 to your computer and use it in GitHub Desktop.
Run a http server with express 3.0.
// dependecies
var express = require('express');
var app = module.exports = express();
// configuration
app.configure(function () {
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});
// routing
app.get('/', function(req, res) {
res.send(200);
});
// start
app.listen(8080);
console.log("Express server started on port %d", 8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment