ExpressJS 4.0: New Features and Upgrading from 3.0

ExpressJS is one of the most well known packages for Node.js. It is a web development framework that helps us create the great applications. It is also the E in the MEAN stack (MongoDB, ExpressJS, AngularJS, Node.js).

Just a few days ago, the Express repo released Express version 4.0.0-rc1. We'll look at the main differences between ExpressJS 4.0 and ExpressJS 3.0. There are a good amount of changes that have taken place which will require us to change the way our MEAN stack apps are setup.

Removed Bundled Middleware

The bundled middleware with Express are the things we use to configure our application. They were things like bodyParser, cookieParser, session, and others.

They were removed into their own modules so that they could receive fixes, updates, and releases without impacting the main express release cycles.

ExpressJS 3.0

In an Express 3.0 application, we would use app.configure() to set up the middleware we would need.

ExpressJS 4.0

Now in Express 4.0, all middleware (except static) have been removed and will need to be called separately. These middleware dependencies were included in the Connect package. Since connect is no longer a dependency, we will have to call the middleware ourselves. Here is a table of all the middleware that came with 3.0 and what it is now called.