Skip to content

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

@Korayem

Description

@Korayem

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

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions