Created
October 18, 2012 07:14
-
-
Save fengxx/3910261 to your computer and use it in GitHub Desktop.
simple web server to host static content
This file contains hidden or 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
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