<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Refresh &#187; Node.js</title>
	<atom:link href="http://www.refresh.dk/topic/node-js/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.refresh.dk</link>
	<description>Web programming for practitioners</description>
	<lastBuildDate>Sun, 02 May 2010 16:25:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Taking out node.js for a spin with Bomber</title>
		<link>http://www.refresh.dk/node-on-bomber/</link>
		<comments>http://www.refresh.dk/node-on-bomber/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 21:39:59 +0000</pubDate>
		<dc:creator>Steffen Tiedemann Christensen</dc:creator>
				<category><![CDATA[Bomber]]></category>
		<category><![CDATA[Introspection]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[Web servers]]></category>
		<category><![CDATA[Web services]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://www.refresh.dk/?p=66</guid>
		<description><![CDATA[The node.js project has been getting a lot of good press and positive attention over the past few months. With good reason. If this is the first you&#8217;re hearing of node.js, it&#8217;s officially an &#8220;evented I/O for V8 JavaScript&#8221; but more generally it is used as a tool for writing non-blocking network servers. This means [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://nodejs.org/">node.js</a> project has been getting a lot of good press and positive attention over the past few months. With good reason. If this is the first you&#8217;re hearing of node.js, it&#8217;s officially an &#8220;evented I/O for V8 JavaScript&#8221; but more generally it is used as a tool for writing non-blocking network servers. This means that it can easily be made into a JavaScript-based and highly efficient web server. If you&#8217;re curious, have a look at <a href="http://simonwillison.net/2009/Nov/23/node/">Simon Willison&#8217;s nice write-up</a>.</p>
<p>Node is still in it&#8217;s infancy. For example, there&#8217;s is still a lot of discussion going on <a href="http://groups.google.com/group/nodejs">on the mailing list</a> about core API (i.e. <a href="http://groups.google.com/group/nodejs/browse_thread/thread/4a1ce27a1f588a7f/28b8fb57bb126ee2">how to handle communication between and chaining of events</a> or even <a href="http://groups.google.com/group/nodejs/browse_thread/thread/c1553dda2f860bb9">how the final file API is going to look</a>). Since node isn&#8217;t designed explicitly as a web server, there&#8217;s only low-level http support &#8212; and of course, there is no standard web application framework for handlings requests, sessions, cookies, and users. </p>
<p>The first question to be answered is if you&#8217;d actually want big web applications to run solely on node.js? But for now I&#8217;ve skipped that question entirely and simply asked how I&#8217;d approach writing such and application (hopefully reusing some of the code being currently being pushed by the node community)? </p>
<p>It seems as if every person in that community has written her or his own lightweight library for handling web requests. To name <a href="http://wiki.github.com/ry/node">a few</a>, there&#8217;s <a href="http://github.com/simonw/djangode">Djangode</a>, <a href="http://github.com/visionmedia/express">Express</a>, <a href="http://github.com/ujh/coltrane">Coltrane</a>, <a href="http://github.com/raycmorgan/vroom">Vroom</a>, and <a href="http://github.com/creationix/node-router">node-router</a>). A lot of these are obviously inspired by the approaches taken by either Django or by Rails (it&#8217;s right there in the names), but taken as a whole they&#8217;re very limited in how they approach the task. Most of the frameworks are just different syntaxes for binding a JavaScript <tt>function() {}</tt> to a URL &#8212; without the modular approach taken by their more mature counterparts. </p>
<p>This means that you can easily use any of these frameworks if you need to write up a simple &#8212; and fast! &#8212; web app in a single file with a few hundred lines of code (in that case, I&#8217;d opt for Djangode), but you&#8217;d be stomped if wanted different, re-usable applications meshing into a single project. <a href="http://benjaminthomas.org/2009-11-20/designing-a-web-framework.html">Benjamin Thomas has gone in designing mode</a> in order to come up with a mini-framework which isn&#8217;t quite as <i>mini</i> as the ones listed above. His ambition is to build&#8230;</p>
<blockquote><p>- The ability to bundle up a collection of controllers/views, models and templates into “apps” for easy portability and reuse.<br />
- Smart defaults that hide a lot of the options/power/complexity. I think this is important for getting up and running quickly.<br />
- A code base that is as small and simple as possible.<br />
- I want it to feel javascript-like. Whatever that means. </p></blockquote>
<p>The end result is <a href="http://bomber.obtdev.com/">Bomber</a>. I like how Bomber creates simple URL routing to file-based (or rather node.js module-based) views, and how it lightly extends the core <tt>http.ServerRequest</tt> and <tt>http.ServerResponse</tt> objects. It feels almost native, but you see that enough of a foundation exists for this framework to actually include the ability to handle POSTs, sessions, cookies, multiple applications within a project and so on. There are no great ambitions where the framework will suddenly include a native XML parser (just a random example, sorry), but there&#8217;s enough room to grow and spread the webby wings a bit.  </p>
<p>The Bomber project is very much in flux. In fact, it might even be dead since the last commit is a month old. And the entire project is build around an <tt><a href="http://bomber.obtdev.com/docs/action.html">Action API</a></tt> which about to be deprecated. Hopefully to be replaced with <a href="http://api.dojotoolkit.org/jsdoc/1.2/dojo.Deferred">DOJO-style</a>, native <a href="http://groups.google.com/group/nodejs/browse_thread/thread/4a1ce27a1f588a7f/28b8fb57bb126ee2">Deferreds</a>.</p>
<p>I&#8217;ve been playing around a bit by adding some extra stuff to Bomber through <a href="http://github.com/steffentchr/bomberjs">my own fork at github</a>. I&#8217;ve already tweaked a little with the app structure to allow for multiple projects to be bootstrapped with different configurations from the same Bomber library, and there is some copy-paste and bug fixes in there as well. This will likely include experiments with multi-application projects, per-application media directories, cookie and session handling and templating (although I disagree with Benjamin that Bomber should include its own templating system; this could probably be left for the programmer to choose).</p>
<p>And now, back to Jersey Shore, bitches!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.refresh.dk/node-on-bomber/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
