Connect - Middleware For NodeJS
Yesterday myself and Tim Caswell open-sourced the first Ext JS nodejs project, Connect. Connect is an abstraction layer, providing node developers with an effective, high performance solution for rapid development using interchangable components called "middleware".
Middleware provides node developers with simple "plug and play" modules,
which may be stacked in any order desired, aiding in rapid development. Connect
middlware are regular node modules exporting the
handle() method, however conceptually
they fall into two categories, filters, and providers.
A "filter" conceptually sits arbitrarily within the middlware stack, processing incoming and outgoing traffic, but typically does not respond to a request. An example of this is the log filter provided by Connect, it does not respond to any request, it simply proxies function calls in order to log request data.
A "provider" differs conceptually in the fact that it provides an end-point in the stack. However this may not always be the case. For example a json-rpc provider may choose not to process or respond to a request if the Content-Type header is not application/json. A classical example of a provider is the static provider which serves static files.
Connect is a dual purpose library, rapid development is not the only goal in mind. Also provided is the connect executable which can be used to daemonize Connect servers (and regular node servers) using an extremely simple command-line interface.
For more information on the connect executable install Connect and run:
$ man connect
The benchmarks bundled with Connect consistently showed that the library has nearly no overhead compared to a regular node server when responding with the typical "Hello World" response.
Next up we have node, sinatra (thin), and Connect serving jquery.js, a roughly ~57kb.
If you wish to run the benchmarks on your own machine, first execute:
$ make benchmark
Then generate the graphs with gnuplot:
$ make graphs
$ open results/graphs
Connect is awesome, what are you waiting for! head over to the Github repo and fork away.