I am Hack Sparrow
Captain of the Internets.

My book on Express.js is published

I have been blogging about Express.js for quite some time now. Early this year, I was contacted by Packt, enquiring me if I'd be interested in writing a book on Express. A year ago, I had this idea to write a book on Express, which would be titled "Mastering Express.js", and worked out an early-stage table of contents for it. So when Packt contacted me, I told them that I would, in fact, be very interested in writing a book on Express. Sin ...

Handle File Uploads in Express (Node.js)

Handling file uploads was a pain in Node.js some time ago. Then came formidable. It was a good start but uploading files was still not easy. Then came connect-form which made things a little easier, based on which I wrote a tutorial on ...

How to forward non-www to www domain name and vice-versa in Node.js (Express)?

Forwarding domain names according to the requirements of 'www' is trivial in Apache using .htaccess. It's not hard either in Node.js, if you are using Express. Put the route definition of your requirement on top of all other routes in Express. This will detect the presence of 'www' and redirect the request to the domain name without 'www'. The status code of 301 means that it is a permanent redirect. If you omit the status code it doe ...

Form Handling / Processing in Express.js

Depending on where you come from, you either call it form processing or form handling, but they mean the same thing - doing stuff to things submitted through an HTML form. In this tutorial I'll show you how to handle all aspects of form processing in Express.js. Express.js is the most popular web development framework as of this writing. There are two major aspects to HTML forms: i. GET requests, ii. POST requests. Let's see how we deal with them in Express. ...

Two common Nodejs NPM Permission Denied errors on Linux

Permission Denied: '../lib/node_modules/npm/bin/npm-cli.js' You are likely to encounter this error when you try to install npm. Even chmodding '/lib/node_modules' recursively won't fix the problem. You get this error and npm just fails to install: [code] $ curl http://npmjs.org/install.sh | sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload ...