fix: populate static API routes for our staticRouteMatcher #875
+142
−25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Next filters out all static routes that starts with
/api
on this line fromroutes-manifest.json
.This makes both static API routes from page router and app router (including page.tsx in
/api/*
on app router) not get caught by ourstaticRouteMatcher
cause it relies onroutes-manifest.json
to have those routes. If you had a catch-all route at the root (i.e:/[[...catch-all]].tsx
) withfallback: false
it would break all API routes causehandleFallbackFalse
inroutingHandler
would return a 404. In this PR we include those routes and can also get rid ofisApiRoute
inroutingHandler
. As it wont be needed anymore.I added an E2E to
app-pages-router
to showcase this. Without the fix in this PR thetests-e2e/tests/appPagesRouter/api.test.ts
would fail, and possibly more. As we would get a 404 instead.Reference for the Discord thread