What's new in Express 5?

What's new in Express 5?

Express 5.0 is still in an alpha release stage but there are a few changes coming that developers should be aware of. In this article we'll discuss the changes that the latest version of Express is going to bring.

Express 5 is not going to be really different from Express 4 however there will still be some breaking changes which means that code written using Express 4 may not work with Express 5.

Install Express 5

Installation is possible via npm by executing npm i express@5.0.0-alpha.2.

Changes in Express 5

Let's now take a look at what changes will Express 5 bring - the changes can be categorised into removals, changes and improvements. There are a bunch of methods and properties that have been removed, some have a changed signature and some have seen improvements.


In Express 5 you cannot use app.del() as it's been made deprecate. In order to specify a route for the HTTP DELETE method, use app.delete().


The removal of this function was because since Express 4.11.0 the function is not supported at all anyway.

Pluralised method names

Three functions have received pluralised names, these are :

  • req.acceptsCharsets()
  • req.acceptsEncodings()
  • req.acceptsLanguages()


Retrieving parameter data is now only possible via directly accessing the submitted parameter name via req.params, req.body or req.query.

res.json(obj, status) and res.jsonp(obj, status)

Before res.json() could be used to send a JSON object, followed by an HTTP status code as a second parameter. From Express 5 the status needs to be sent via an appropriate function, followed by chained function call to .json(): res.status(statusCode).json(obj).

The same applies to res.jsonp.

res.send(body, status) and res.send(status)

Just as explained earlier, the res.send() method can no longer be used to send status codes. To send data and a status code use chained functions: res.status(statusCode).send(body).

In order to only set the status, as of Express 5, use res.sendStatus(statusCode).

Please note that for situations when we'd like to send a number as the data, we need to quote it or otherwise convert it to a string so that Express is not going to attempt to use the old function signature.


This method has been replaced with a camel-cased version: res.sendFile()


app.router was removed in Express 4 and now it's back in Express 5 - as a reference to the base Express router.

In Express 5 the function maintains the port number as well (in Express 4 the same function incorrectly strips the port number)


We can now pass in false as an option to this method in order to be able to implement our own query string parsing logic.


The render method is now enforcing asynchronous behaviour for all view engines.


Tamas Piros

Developer Evangelist, experienced Technical Trainer and Google Developer Expert in Web Technologies. Active conference speaker, passionate about the latest & greatest advancements in web technologies.

View Comments
Next Post

Façade Pattern in TypeScript

Previous Post

Abstraction in TypeScript