I’ve been working with Node.js on the Raspberry Pi, particularly with regards to the web application framework Express and the page template engine Jade. My past experiences with web tools like these goes back to the late 1990s with Microsoft’s early IIS and ASP pages, IE 4, msxml 0.8 and Microsoft’s initial Dynamic HTML implemention, through plain old Apache 1.0 with Perl, to Tomcat and JSP pages and Ruby on Rails to Node.js and Express and Jade with a side trip to EJS.
I’ve been following a tutorial titled “Creating a basic site with Node.js and Express” to create an initial application. Interestingly enough, even though the tutorial was written back in April 2011, it was still reasonably up to date. I had one deprecated call in app.js (replacing “app.use(express.bodyParser())” with “app.use(express.json())” and “app.use(express.urlencoded())”) and one error in a Jade template file (replace “!!! 5” with “doctype html” in views/layout.jade). Once those minor fixes were in place I was able to start up my very simple Node web server and have it deliver the sample page (see below) to my various home devices on my internal home network. You see a screen capture on the Nexus 7 2012 running Opera. If I’m going to use Node on my R-Pi, then I’m going to make full use of it. The screen capture above shows the system resources via htop in the upper left window, and the simple Node application with logging running in the upper right window.
As usual everything is behind a firewall.
My reason for digging into this part of Node is to build a web interface into the i2c and onoff Node modules, and thus the Raspberry Pi’s I/O capabilities. My next release of my Arch Linux image will contain all of this (though not necessarily the final web interface into the Raspberry Pi’s I/O), hopefully this weekend. I will only update the graphic image, not the base image.