frontity / frontity

» Frontity - The React Framework for WordPress
https://frontity.org
Apache License 2.0
2.94k stars 256 forks source link

Create a wrapper to modify ctx.next #699

Open SantosGuillamot opened 3 years ago

SantosGuillamot commented 3 years ago

This is part of the Server Extensibility feature. For full context please check out the final Implementation proposal.


Create a wrapper to populate ctx.next so the middleware can work with the signature fn({ ctx, next }).

Luis has been reading the Koa's code and he thinks this simple wrapper should be enough:

const wrapper = (fn) => (ctx, next) => {
  ctx.next = next;
  return fn(ctx, next);
};

Dependencies:

Populate the middleware array with the correct packages.

Relevant code:

SantosGuillamot commented 3 years ago

I am marking this issue as blocked until the dependencies are finished.