Book review

“Mastering Web App Development with Express” by Alexandru Vlăduțu. ISBN 978-1783981083.

Node.js has a healthy ecosystem of web app frameworks, the popular ones would be Express, Koa, Sails and Meteor.

I chose Express as its probably the most mature web framework for Node, my second choice would be Meteor which only recently hit the 1.0 milestone at the time of this writing.

The only references I had while learning Express six months ago were the online documentation and a couple of Express 3.x books, some good, some superficial. Most of the books out there were written for Express 3.x, and things had changed significantly as Express 4.0 had slimmed down considerably with several modules, including Connect, were refactored out of Express, leaving me, then just getting started with Express, unsure of what components were taken out.

So when review copies of this book were made available, I was keen to read it.

If there’s only one chapter you must read, read Chapter 1 – it dives straight into creating an MVC web app, if you follow the examples you will save yourself days figuring it out yourself, and emerge with a better view of the framework, request routing and data persistence with MongoDB.

Before this book came along, I researched template engines for Express, and got the impression that Jade was the preferred engine for Express, but I baulked at the syntax. I was then just getting started with Express and was more comfortable & productive with EJS, but I still did not have a complete picture of templates. So I was pleased to see this book has an entire chapter dedicated to template engines that starts off by covering the fundamentals and classifies them into 3 categories. I would have liked to see the author recommend one, from the book examples EJS does seem to be a preference. The chapter summary provides an “it depends” answer by weighing decisions to be made when choosing a template engine.

For debugging & logging, the book uses error-handler, and touches on Nodes built in debug & node-inspector. If you’re new to node-inspector, you should first try debugging something simple like the FizzBuzz below to get the hang of it.

var x = 1;

setInterval( function () {
    
        var out = "";             
        if(x%3 == 0) out += "Fizz"; 
        if(x%5 == 0) out += "Buzz";
        console.log ("%s", (out == "")? x : out); 
        x++;

}, 1000 );

The chapter on application security covers authentication and includes examples that mitigate against CSRF & XSS attacks. The book also covers the current state-of-the-art of testing with Mocha and should.js, CI and production apps.

I did find the style of presentation a bit code heavy & to the point. This book reads more like a mathematics book than a typical JavaScript book.

Overall, this book is a good attempt at covering a lot of material with hands-on examples, and is a useful go-to book for Express web app development.

Thanks for reading.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s