Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for middleware property to govuk-prototype-kit-config.json file #1828

Closed
1 task
lfdebrux opened this issue Dec 1, 2022 · 2 comments
Closed
1 task
Labels
🕔 Days A few unknowns, but we roughly know what’s involved.

Comments

@lfdebrux
Copy link
Member

lfdebrux commented Dec 1, 2022

What

Allow plugin authors to add middleware property to govuk-prototype-kit-config.json file. If they provide the path to a valid module in their package, then we will require that module and call the exported function to obtain a middleware function, which we will then attach to the prototype app.

Why

See #1798 for details.

Who needs to work on this

Developer

Who needs to review this

Developer, Tech lead

Done when

  • Plugin authors can add middleware to plugins, users can add middleware when they install plugins
@lfdebrux lfdebrux added 🕔 Days A few unknowns, but we roughly know what’s involved. awaiting triage labels Dec 1, 2022
@lfdebrux
Copy link
Member Author

lfdebrux commented Dec 1, 2022

In govuk-prototype-kit-config.json, type of middleware should be string | [string]. If any of the strings are not a valid path to a module within the plugin package, that is an error.

Middleware module should export one function that returns a middleware function: module.exports: () => (req, res, next) => void.

In future the kit will supply arguments to module.exports to allow configuration of the middleware, however that is out of scope for this ticket.

@joelanman
Copy link
Contributor

closed until we investigate as per #1829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕔 Days A few unknowns, but we roughly know what’s involved.
Projects
None yet
Development

No branches or pull requests

2 participants