Skip to content

Instantly share code, notes, and snippets.

@fengxx
Created October 18, 2012 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fengxx/3910261 to your computer and use it in GitHub Desktop.
Save fengxx/3910261 to your computer and use it in GitHub Desktop.
simple web server to host static content
var express = require('express');
var app = express();
app.use(express.logger())
app.use(express.static(__dirname + '/public'));
app.use(express.bodyParser());
var port = process.env.PORT || 5000;
app.post('/testpost', function(req, res) {
res.send(JSON.stringify(req.body));
});
app.listen(port, function() {
console.log("Listening on " + port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment