Foreword to Express.js Guide: The Comprehensive Book on Expresss.js

Dear reader, you are holding a book which will open you to understanding and fluent usage of the Express.js framework – standard de facto in web application programming on Node.js. And I would especially recommend this book because it was written by a practicing engineer, one who has a comprehensive knowledge about the full stack of web application development and Express.js in particular…

Dear reader, you are holding a book which will open you to understanding and fluent usage of the Express.js framework – standard de facto in web application programming on Node.js. And I would especially recommend this book because it was written by a practicing engineer, one who has a comprehensive knowledge about the full stack of web application development and Express.js in particular.

Azat and I worked on the same Node.js/Express.js code base at Storify — the social media curation tool that Washington Post, CNN, BBC, The White House and other news corps use — which was recently acquired by LiveFyre. Right before the Express.js Guide release, he asked me to write the foreword, because it’ll sound objective, sincere and unbiased coming from the creator of another Node.js framework — CompoundJS.

However, nobody is reading forewords. So, instead of a foreword, I’ll share my story. Actually, I never thought it was worth sharing and there’s definitely nothing exciting about it. But from the other point of view — thousands of young programmers living similar ordinary lives – it could be inspiring: it’s a common story, but a kind of successful one.

My way to web development started when I was a student and joined a team as junior PHP programmer. I was working here for about 5 years and the main lesson I have learned was: education is nothing compared to real work experience. The next page of my professional life was work in outsourcing (PHP and Ruby on Rails). And then I found Node.js.

It was something that I always wanted: processes that do not have to wait for DB/IO operations which are keeping all the resources, but doing something useful instead. This is the simple reason why I started using it; it’s more efficient compared to synchronous programming environments. By “efficient” I do not mean not speed of processing, but more flexibility in programming style.

As a good example of this flexibility, I can share some solutions I recently programmed for a Redis adapter for the Jugglingdb ORM. Problem: during peaks of website usage, we are running a lot of db queries to serve pages, and most of the queries are the same. The obvious solution is to cache results of the queries, but this solution requires additional coding and some logic for cache invalidation. We’ve come with a better solution: cache queries and not results. When a query comes, we don’t execute it immediately; instead, we wait for some time, collect identical queries, then execute query once and run multiple callbacks to serve all clients. This solution is simple and requires no additional logic. As a result, we have flat db usage even during peaks. This solution is natural in Node.js, and that’s why Node.js rocks!

Life after discovering Node.js was great, full of interesting challenges and work, but one thing was annoying: each time I start a new project, I have to do almost the same work to organize code. For me as a Rails developer, it was really great to be able to create well-structured MVC applications fast, generate scaffolding controllers / views and other stuff. But this kind of tool was missing in Node.js and that’s why I spent my Christmas holidays writing it; the project was called express-on-railway at first, then RailwayJS, then CompoundJS.

The main goal of this project was to bring structure to an Express.js application, add the ability to extend applications in a standard way, and generate application code. So, it was not a new framework, but just Express.js with decent MVC structure, which is good for developers who don’t need to learn anything but Express.js to be able to understand what’s going on in CompoundJS application. And it was a kind of piggybacking on Express.js and Rails experience: the idea was to get best ideas from rails and bring to node platform, and Express.js was selected as the base because it is the most popular framework for Node.js and has a relatively big community, so I won’t be alone with my “new framework”. It was the start of my open-source years, which completely changed my attitude to programming and all matters, but this is another story.

And what can I say to conclude: web development in Node.js started with Express.js. It is a minimalistic and a robust framework which gives you all you need to build decent web applications. Even if you decide to move to some more advanced frameworks at some point, Express.js knowledge is a basic skill you have to learn. In addition, this book contains everything you need to know to start using Express.js and clearly explains all concepts and answers to most of the questions that newcomers usually ask. For these reasons, this book is a must read!

Anatoliy Chakkaev,

Creator of CompoundJS and JugglingDB

Author: Azat

Techies, entrepreneur, 20+ years in tech/IT/software/web development expert: NodeJS, JavaScript, MongoDB, Ruby on Rails, PHP, SQL, HTML, CSS. 500 Startups (batch Fall 2011) alumnus. http://azat.co http://github.com/azat-co

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.