Combining All the Things: GraphQl Middleware to Give All Your Decoupled API's a Single Home.

Presenters: danrogers, nickrigby

A decoupled, API-first architecture can be fast and efficient. But it can also generate lots of different things in the oddest places: calendar events over here, a newsroom over there, and loads of actual content in a whole bunch of places. And if you’re a developer interacting directly with multiple separate APIs, frontend builds can get complicated quickly as dev teams and stakeholders struggle to understand how to access each different API in your ecosystem.

Enter Middleware. In this session, we untangle the mess of decoupling by creating a simple node based (node.js) Express Middleware server that will combine all of your multiple API's into a single endpoint, all query-able by GraphQl.

Imagine working on a single API that combines all of the separate API endpoints into a common schema, and becomes accessible via the powerful, and awesome GraphQl syntax.

Some benefits of Middleware/GraphQl:

  • Unlike (most) REST endpoints, use a single, simple HTTP request to make multiple requests, asking for only the fields needed.
  • Simplify, streamline and standardize JSON responses for frontend development.
  • Ability to add custom access, and caching functionality unique to the middleware.
  • Ability to provide custom callbacks on fields/entities/etc.
  • Ability to build custom callbacks to combine data from different API's into a single combined endpoint for your frontend clients. 
  • And more!

In this session we will share simple examples of:

  1. Single endpoint interacting with D7 site.
  2. Single endpoint interacting with D8 site.
  3. Single endpoint interacting with agnostic public API.
  4. Single endpoint that combines several API endpoints into a single call, and subsequent result set

Plus, we’ll discuss common pitfalls, and some ideas that may help you build an awesomely powerful combined API!

Example middleware Repo:

Example middleware sandbox:

Video recording:

Experience Level
Schedule Info
Conference Year
Date / Time
Room G1/G2
Session Track
Coding and Development