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

beforeAll middleware #7

Merged
merged 7 commits into from
Oct 18, 2023
Merged

beforeAll middleware #7

merged 7 commits into from
Oct 18, 2023

Conversation

rawnly
Copy link
Owner

@rawnly rawnly commented Oct 18, 2023

Fixes #6

New api and breaking changes:

  1. Is now available a beforeAll callback that is executed before the request reaches any middleware. It is available both globally and per hostname.

  2. The signature of the handler has changed to use the response generated by the beforeAll callback

declare type Handler = <T>(request: NextRequestWithParams<T>, response: NextResponse, event: NextFetchEvent) => NextResponse
  1. Renamed inecjtor to context
  2. Added a response factory in the options to improve compatibility with other middlewares
  • feat: added beforeAll middleware and renamed injector to context
  • docs: changelog
  • fix: fixed context and response factory
  • docs: updated docs + example
  • chore: updated versions
  • docs: copy readme to package folder
  • docs: readme update

@rawnly rawnly linked an issue Oct 18, 2023 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Oct 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
next-wayfinder ❌ Failed (Inspect) Oct 18, 2023 4:03pm

@rawnly rawnly merged commit c1a0e42 into main Oct 18, 2023
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Global/before all middleware
1 participant