Middleware gets purged after API reload

There’s a slight confusion here as to what CE is and what Pro is, I’ll clarify here:

  • CE is just the gateway, configured using files, and no dashboard - you can still get analytics, but you need to use your own BI solution and Tyk Pump to get the data into your DB of choice, CE is a completely open source option, there are no closed-source components
  • Pro has a free tier, where you can have 1 gateway with the dashboard, as soon as you are running a dashboard, you are in the territory of the Pro documentation, anything over 1 gateway gets you into the paid-for Pro territory where you need a license.

So @jess is correct in recommending the folder-based loader as it is by far the fastest and easiest way to debug and run your JS MW.

In v2.2 of the gateway (v1.2 of the dashboard), the middleware component of the API definition was not saved even if it had been written to the DB, and so vanished when you modified it via the API/DB and then edited via the dashboard.

In v2.3 this restriction has been removed, and the middleware block can be added to the API definition with the REST API, but there is still no UI for it.

In v2.3 there is also the option of using an asset server, this server can then host “bundles” that your gateway can fetch, verify and unpack into the coprocessor, there’s a CLI tool too, to help put them together and the docs are in all the tutorials.