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

Feature Request: allow adding another middleware array optional param, to be executed at the end of the chain #11

Open
Korayem opened this issue Jun 5, 2022 · 0 comments
Assignees
Labels

Comments

@Korayem
Copy link

Korayem commented Jun 5, 2022

Suggestion:

import { compose } from 'next-api-compose'

export default compose([preWithBar, preWithFoo], [postWithBar, postWithFoo], (request, response) => {
  const { foo, bar } = request
  response.status(200).json({ foo, bar })
})

Some of the reasons:

  • Logging
  • APM performance tracing
  • fetch.waitUntil() to trigger custom business logic (purge/refresh cache, CRUD events)
  • Analytics
  • HTTP Edge Cache storage of the response body
@neg4n neg4n self-assigned this Jun 29, 2022
@neg4n neg4n added enhancement New feature or request target: pages router labels Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants