Created
March 24, 2011 09:01
-
-
Save fdomig/884772 to your computer and use it in GitHub Desktop.
A sample node.js sensor
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
var argv = require('optimist').argv; | |
var http = require('http'); | |
var temp = function() { | |
return '17'; | |
} | |
http.createServer(function(req, res) { | |
console.log(req.method + " " + req.url + ' HTTP/' + req.httpVersion); | |
res.writeHead('200', {'Content-Type': 'text/plain'}); | |
res.end(temp()); | |
}).listen(argv.port, argv.ip); | |
console.log('Server started at http://' + argv.ip + ':' + argv.port + '/'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment