Friday, March 1, 2013

One liner http server


Since the day a friend of mine introduced me to nodejs, I now use it for all kind of daily stuff.
Today I had to troubleshoot connections behind a firewall. This easy node one-liner helped me do that:

$ node -e 'require("http").createServer(function(req, res){ console.log("Got request"); res.end((new Date) + ""); }).listen(3001);'

Cheers.

No comments:

Post a Comment