Skip to content

Migration from v3 to v4

Igor Ramadas edited this page Jul 10, 2019 · 4 revisions

Expresser has its core principles changed on v4. Up to v3, it adopted a "do-it-all" and "try-it-all" approach. It was bloated. On v4, which was built almost from the ground up, it includes only the very essential feature set which should be required by any standard Express application, be it a REST API or a full-fledged website.

It also drops lots of assumptions about what the developer wants to do. Now, for the most part, if something fails an exception is thrown and the developer can decide what to do and how to proceed.

expresser-legacy

The easiest way to migrate v3 apps to v4 is by using the expresser-legacy adapter. To install:

$ npm install expresser-legacy

And then to setup:

let expresser = require("expresser")
let expresserLegacy = require("expresser-legacy")

expresserLegacy.init(expresser, true)

The second parameter, useDefaultSettings, is set to true above, meaning it will load all default settings from the legacy modules and plugins. If you have loaded all the required settings prior to calling the init() method, you can pass it as false, so:

expresserLegacy.init(expresser, false)

Supported plugins

The following plugins from v3 are fully supported when using expresser-legacy:

  • expresser-aws
  • expresser-mailer
  • expresser-metrics
  • expresser-swagger

Other plugins had very little usage (data from NPM and GitHub) so no guarantees that they will work.

Getting rid of legacy code

Some of the features previously available in Expresser were decoupled and are now separate modules:

  • Logger expresser.logger can be replaced by Anyhow
  • Settings expresser.settings can be replaced by SetMeUp
  • Utils expresser.utils can be replaced by JAUL
  • Metrics expresser-metrics plugin can be replaced by Monitorado
Clone this wiki locally
You can’t perform that action at this time.