Skip to content

Instantly share code, notes, and snippets.

@shanewholloway
Created May 2, 2017 14:51
Show Gist options
  • Save shanewholloway/2931019725da544e2e9fdd6386bd2989 to your computer and use it in GitHub Desktop.
Save shanewholloway/2931019725da544e2e9fdd6386bd2989 to your computer and use it in GitHub Desktop.
Node one-line demo server
#!/bin/bash
node -e 'require("http").createServer((req,res) => {res.end([[req.method, req.httpVersion, req.url], ["On host:", require("os").hostname()], []].map(l=>l.join(" ")).join("\n"))}).listen(3001, "0.0.0.0", ()=> {})'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment