API Strategies: How to use Express.js Middleware for Growth

Why Express.js Middleware?

When we set out to build an open source API Gateway, we had a lot of tough choices ahead of us. What frameworks should we use?  How do we provide the best possible experience for developers?

One of the key reasons why we built Express Gateway on ExpressJS is because of an existing rich ecosystem of 3,000+ middleware modules already being used out of the box with Express.js.  Not all Express.js modules are relevant to the API gateway use case – but many are.  

So, almost all API gateway use cases can utilize an existing Express module.

In fact, that’s exactly what happened – all initial features supported by Express Gateway were entirely built using existing Express middleware as a starting point.

Doing this has realized the following benefits:

  • Speed up to time to value by not starting from scratch
  • Simplicity through familiarity – by building on something that is already familiar in the community.

All about those Express.js Gateway Plugins

Express Gateway Plugins extend Express Gateway.  ANY Express.js middleware can be taken and rolled into Express Gateway.

Initially, Express Gateway features are part of the core offering.  Instead of refactoring the features into separate plugins. We built the plugin foundation first and decided to bundle everything as part of the core along with the the plugin foundation to get the Express Gateway out sooner.

What Are Plugin Extension Points?

The Express Gateway Plugin Framework will support the following extension points for Express Gateway entities:

  1. Conditions
  2. Policies
  3. Routes
  4. Services + DAO for supporting database other than redis  
  5. Credential types
  6. Models
  7. Admin REST API routes
  8. HTTP and HTTPS servers routes
  9. HTTP and HTTPS servers custom events (like upgrade for websockets)
  10. CLI

So, as you can see from above, the plugin capabilities are extensive.

Below is an overview of the iterative development planning going into the Express Gateway Plugin Framework as well as future plugins.

Iteration 1: A Plugin Example

In the first iteration, the team is going to do complete three things:

  1. enable the base plugin framework within Express Gateway
  2. enable extension points for the first three entities: conditions, policies and routes
  3. provide a reference example of a plugin (express-gateway-plugin-example) that the plugin framework will be able to install to illustrate the mechanics of how a plugin extends Express Gateway

The plugin framework allows you to use Express.js Middleware in Express Gateway. Also, it takes advantage of existing services, models and metadata.

Iteration 2: More Extension Points

At this point, plugins can utilize existing Express Gateway entities.

So, the next iteration will extend the plugin framework to address the next three extension points:

  1. Create new services
  2. Explore new credential types
  3. Examine new models
  4. CLI (additional Yeoman generators)

By enabling these extension points, more complex plugins can add functionality and data that is not included as part of the Express Gateway core.

Iteration 3: Real Middleware Plugin Example

After the community has seen the reference example for a plugin, the team will take an existing Express middleware that has been highly sought after – JWT Authentication and chronicle a “how to” of taking a middleware and transforming it into an Express Gateway plugin.


  • Sign up for our private beta – your feedback helps prioritize our roadmap with the most value realized within the shortest amount of time
  • Check out our Open Source Initiative: The Express Gateway
  • Learn about the inaugural feature set we’re striving for to make APIs repeatedly fast, easy and manageable as you evolve through the API lifecycle itself.
  • Sign up for the latest development on APIs and microservices.