To Engineers Who Tried to Use Jade Template Engine and Can’t Get Started

When I started working at Storify as a Node.js Engineer. The tech stack was Express and Jade. I hate to admit it, but I struggled with Jade a lot!

Before, I mostly worked with Underscore, and Handlebars. I attempted to modify some HTML in the Jade templates. Other times I would only change the text. Those were trivial updates, but very often they cause the whole server to crash.

I was failing miserably to learn by trial and error. I hated Jade. I was starting to hate editing templates as well. Then I had a light bulb moment: I need a tutorial. I went to the official docs. I wish this article existed at that time. After spending just an hour learning Jade, I was able to use Jade and make all the changes to templates smoothly.

Smart people learn by their mistakes, and wise people learn from others. Don’t repeat my folly. Skim through this Jade tutorial to harness the power of this wonderful template language.

Continue reading “To Engineers Who Tried to Use Jade Template Engine and Can’t Get Started”

How to Write Your First Test With Mocha

The goal of this mini-project is to add a few tests for Blog.
The project is on GitHub at

We won’t get into headless browsers and UI testing, but we can send a few HTTP requests and parse their responses from the app’s REST end points.

Continue reading “How to Write Your First Test With Mocha”

How To Use Mocha With Node.js For Test-Driven Development to Avoid Pain and Ship Products Faster

Test-driven development (TDD) , as many of you might know, is one of the main, agile development techniques. The genius of TDD lies in increased quality of code, faster development resulting from greater programmer confidence, and improved bug detection (duh!).

Historically, web apps have been hard to autotest, and developers relied heavily on manual testing. But, certain parts such as standalone services and REST API can be and should be tested thoroughly by the TDD. At the same time, rich user interface (UI) / user experience (UX) can be tested with headless browsers such as PhantomJS.

Continue reading “How To Use Mocha With Node.js For Test-Driven Development to Avoid Pain and Ship Products Faster”

Node Program Lecture

Node Program is ideal for people new to Node, and for those who can use some help with JavaScript itself (stuff like “this”, prototype, var, etc.). In the first few lectures, I cover JavaScript fundamentals. Here’s a video of the beginning of one of the previous Node Program trainings: It’s 19 minutes and a part of a six-hour self-study online course.

The End of Node.js?

UPDATE May 21, 2016: The io.js became Node.js and everything is better then ever. Conclusion? Avoid drama, speculations and distractions. Just keep on building useful and good applications.

There have been a lot of buzz around io.js for the past few months. Basically, io.js is a branched (forked in Git/GitHub terminology) version of Node.js.

One of the main reasons to deviate from the main Node.js project was to speed up the development. This way io.js can have more recent features from Google Chrome V8 and ECMAScript6. Those are good things, right? Then, why there has been so many concerns over the future of Node.js/io.js? Why some people were confused and skeptical?

Continue reading “The End of Node.js?”

CoffeeScript: The Good Parts-Write Better JavaScript

I’ve published a new short course on CoffeeScript. The course will teach you major benefits of using CoffeeScript to write better JavaScript code for both browser and server.

You can save 66% off and get this course for only $3 with the code “wal”, or by clicking this link —>>>

As always, the course has some bonus content. More information and preview is available as well.

Pro Express.js Q&A (Recording)

Last week, I did a live Q&A session for people who bought my new book Pro Express.js, but you can watch the recording here. Click on the apps icon (next to the ? icon), and then click on the Q&A button to see the questions. If you haven’t bought Pro Express.js, then you can do it on… and start mastering the framework for you Node.js web development.

PS: You can also watch the session on YouTube, but I recommend Google +.

Here is the summary of questions and answers which you can also get in a PDF —>>> Pro Express.js Q&A, or read below.

Continue reading “Pro Express.js Q&A (Recording)”

Pro Express.js: Master Express.js—The Node.js Framework For Your Web Development Is Out

The long-anticipated Express.js manual is ready and was sent to to print at this week (December 24, 2014). To summarize the book, Pro Express.js: Master Express.js—The Node.js Framework For Your Web Development is all about understanding Express.js and building web apps with this framework and its middleware. Spend two minutes to read this post, to know how you can benefit from this valuable resource and the release.

Pro Express.js: Master Express.js—The Node.js Framework For Your Web Development Is Out
Pro Express.js: Master Express.js—The Node.js Framework For Your Web Development Is Out

Becoming a Better Node.js Developer

If you an intermediate or advanced beginner Node.js developer and want to become better at this cool, new technology, then you have lots of questions about the best practices and patterns. Most likely you’ve encountered Express.js, and you wish you knew more about useful settings and options to configure Express.js and its middleware.

The reason why I know these things is that, before I became proficient with Node.js and Express.js, I was a beginner just like you. Also, I’ve been in a position when I needed to learn Express.js quickly. In those sad moments, I was flat out miserable and often had to read the source code for the lack of a good documentation and examples. I wish I had Pro Express.js with me back then to explain the mechanisms in plain English, and provide inspiring code patterns that I could re-use in my projects. That’s why I’m confident that Pro Express.js will be great for intermediate Node.js developers (and advanced-beginners).

Pro Express.js can solve your pains and problems by providing the following benefits:

Continue reading “Pro Express.js: Master Express.js—The Node.js Framework For Your Web Development Is Out”

URL Parameters and Routing in Express.js

TL;DR: This post is about URL parameters and routing in Express.js, and it’s an excerpt (Chapter 6) from my new book Pro Express.js: Master Express.js—The Node.js Framework For Your Web Development. The book was released this week (~December 24, 2014), but we have a great limited-time offer for you which will be announced on Sunday, December 28, 2014 on This post is the last post in the series of excerpts from Pro Express.js with other posts as follow: Error Handling and Running an Express.js App, Express.js Security Tips, LoopBack 101: Express.js on Steroids, Sails.js 101 and Secret Express.js Settings.

To review, the typical structure of an Express.js app fig(which is usually a server.js or app.js file) roughly consists of these parts, in the order shown:

  1. Dependencies : A set of statements to import dependencies

  2. Instantiations : A set of statements to create objects

  3. Configurations : A set of statements to configure system and custom settings

  4. Middleware : A set of statements that is executed for every incoming request

  5. Routes : A set of statements that defines server routes, endpoints, and pages

  6. Bootup : A set of statements that starts the server and makes it listen on a specific port for incoming requests

This chapter covers the fifth category, routes and the URL parameters that we define in routes. These parameters, along with the app.param() middleware, are essential because they allow the application to access information passed from the client in the URLs (e.g., books/proexpressjs). This is the most common convention for REST APIs. For example, the route will use the value of 521eb002d00c970200000003 as the post ID.

Parameters are values passed in a query string of a URL of the request. If we didn’t have Express.js or a similar library, and had to use just the core Node.js modules, we’d have to extract parameters from an HTTP.request object via some require('querystring').parse(url) or require('url').parse(url, true) function “trickery.”

Let’s look closer at how to define a certain rule or logic for a particular URL parameter.

Continue reading “URL Parameters and Routing in Express.js”

Error Handling and Running an Express.js App

TL;DR: This text is an excerpt (Chapter 9) from Pro Express.js: Master Express.js—The Node.js Framework For Your Web Development. The book will be released next week (December 24, 2014), and we’ll announce a great limited-time offer on it on Sunday, December 28, 2014. So stay tuned… and happy Holidays!!!

Good web applications must have informative error messages to notify clients exactly why their request has failed. Errors might be caused either by the client (e.g., wrong input data) or by the server (e.g., a bug in the code).

The client might be a browser, in which case the application should display an HTML page. For example, a 404 page should display when the requested resource is not found. Or the client might be another application consuming our resources via the REST API. In this case, the application should send the appropriate HTTP status code and the message in the JSON format (or XML or another format that is supported). For these reasons, it’s always the best practice to customize error-handling code when developing a serious application.

In a typical Express.js application, error handlers follow the routes. Error handling deserves its own section of the book because it’s different from other middleware. After the error handlers, we’ll cover the Express.js application methods and ways to start the Express.js app. Therefore, the major topics of this chapter are as follows:

  • Error handling
  • Running an app

Continue reading “Error Handling and Running an Express.js App”

Express.js Security Tips


This text is part of my new book Pro Express.js: Master Express.js—The Node.js Framework For Your Web Development [Apress, 2014]. Security is important, that’s why I decided to publish this chapter on my blog. The book will be released very soon.

The set of tips in this chapter deals with security in Express.js applications. Security is often a neglected topic that is deferred until the last minute before the release. Obviously, this approach of treating security as an afterthought is prone to leaving holes for attackers. A better approach is to consider and implement security matters from the ground up.
Continue reading “Express.js Security Tips”

The Node Frameworks Contributor

I want to express gratitude to Randson Oliveira for his contributions to the Node Frameworks project. In fact, he is the #1 contributor on the project right now. Thank you for your dedication!

The Node Frameworks Contributor
The Node Frameworks Contributor

If you don’t know what the Node Frameworks project is about—check it out. The mission of this resource is to provide recommendations and one place for discovering Node.js frameworks and tutorials/examples for them. The stats for each library is really interesting to compare.

LoopBack 101: Express.js on Steroids

LoopBack is a comprehensive Node.js web framework with a rich command-line scaffolding and a web API explorer: The framework is maintained by StrongLoop which is also the gate-keeper of Express.js.

This concise tutorial will illustrate how to get started with LoopBack and the common traits between LoopBack and Express.js. This text is from my new book Pro Express.js by Apress which you can already start reading in Apress Alpha or pre-order on and other bookstores.

Continue reading “LoopBack 101: Express.js on Steroids”

Azat Mardan on NodeJS and Express Interview at QConNY 2014

Here’s my interview with Brian Rinaldi of ModernWeb on NodeJS and Express at QConNY 2014 where I spoke about CoffeeScript. The inverview is 13 minutes long and discusses some controversial topics and my traditionally published book Practical Node.js.

Continue reading “Azat Mardan on NodeJS and Express Interview at QConNY 2014” Got GitHub Stats

Now our hand-picked registry of Node.js frameworks ( has GitHub statistics right on the website, so you don’t have to navigate back and forth when making a decision!

This is how it looks: each framework has a number (GitHub stars) next to its name. This serves as a social proof meaning the more people use the framework the more robust it is and the less bugs it has.

GitHub stats on
GitHub stats on

The buttons provided by the service called GitHub Buttons. The links to the frameworks’ GitHub, NPM, examples and other resources are hidden under the “i” icon.

Thank you Randson Oliveira for contributing and making pull requests!

Secret Express.js Settings

Express.js is one of the top Node.js frameworks out there. It was used in the overwhelming majority of projects that I’ve encountered since I began working with Node.js in 2011. One of the main selling points and key differentiators is the framework’s configurability. However, while writing Express.js Guide and Pro Express.js, I discovered a few secret settings never mentioned in their documentation.

Continue reading “Secret Express.js Settings”

Time to Up Your Node.js Skills

Are you a software engineer who wants to master an effective and fun-to-use, new platform Node.js? Is your goal to stay on top of the curve with cutting-edge technology, and to stay ahead of the competitive software engineering industry by delivering high quality products faster?

Continue reading “Time to Up Your Node.js Skills”

MongoUI: Real-Time MongoDB Admin Web Interface (a la phpMyAdmin in Node.js)

MongoUI is a real-time web interface for Node.js and MongoDB written with DerbyJS—a real-time full-stack web framework. It’s a app that can be run locally and on the server. Similarly, you can view and manipulate data in a local or remote database. The MongoUI project is in beta so use caution, and please contribute your feedback.

MongoUI on NPM:

MongoUI on GitHub:

MongoUI description (this page):

MongoUI features include:

  • Switch databases and collections
  • Search by field value (string, number, ObjectId)
  • Save search / filter results as a bookmark (each URL has a query)
  • Edit any fields’ values in a real-time editor
  • Get raw JSON objects

Here’s a one-and-a-half-minute video that shows filtering, editing, and switching collections:

Direct link to the YouTube video:

Continue reading “MongoUI: Real-Time MongoDB Admin Web Interface (a la phpMyAdmin in Node.js)”