News for hackers. Stuff that matters.
Re:A HTTP Proxy Server in 20 Lines of node.js Code by silvestrov on Wednesday April 28, 2010 @08:15AM (#1301335)
This is not a server in 20 lines of code, but server configuration in 20 lines (there is no parsing of the http protocols, but only calls into a lib that implements an http proxy).

The examples could be implemented in fewer lines of Apache configuration. I would have been nice with some examples that shows what node.js can do, which can't be done (easily) with Apache.

Re:A HTTP Proxy Server in 20 Lines of node.js Code by TimothyFitz on Wednesday April 28, 2010 @12:19PM (#1301908)
Not quite accurate. The code he wrote does the "proxy" logic while libraries underneath it are doing the work of parsing HTTP. He's definitely not doing "calls into a lib that implements an http proxy."

More to the point, what he has is a proxy in 20 lines of code which will let him make, say, a custom load balancing http proxy in 40 lines of code.

Re:A HTTP Proxy Server in 20 Lines of node.js Code by simonw on Wednesday April 28, 2010 @09:15AM (#1301451)
I think this does show something that can't be done easily with Apache: scripting decisions about what to proxy in JavaScript, in this case to implement auto-reloading of configuration files for IP filtering and regex-based host blacklisting.
Re:A HTTP Proxy Server in 20 Lines of node.js Code by zaph0d on Wednesday April 28, 2010 @08:39AM (#1301370)
Agreed, the code is trivial, but HTTP is a first-class protocol on node.js. Can't blame Peter for not reinventing the wheel.
Re:A HTTP Proxy Server in 20 Lines of node.js Code by jimbokun on Wednesday April 28, 2010 @10:31AM (#1301609)
At the top of the page it says "good coders code, great reuse."