Skip to content

Instantly share code, notes, and snippets.

@Torokun
Last active December 30, 2015 02:49
Show Gist options
  • Save Torokun/7765308 to your computer and use it in GitHub Desktop.
Save Torokun/7765308 to your computer and use it in GitHub Desktop.
Oneline HTTPD?
node -e "(function(){var port = 8080; require('http').createServer(function(req, res){req.addListener('data', function(dataChunk){}); req.addListener('end', function(){res.writeHead(200, {'Content-Type' : 'text/html'}); res.end('Hello, World');});}).listen(port);})();"
@esperia
Copy link

esperia commented Dec 3, 2013

npm i connect && node -e "var connect = require('connect'); connect.createServer( connect.static(process.argv[1])).listen(8080);" `pwd`

http://stackoverflow.com/questions/6084360/node-js-as-a-simple-web-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment