-
Notifications
You must be signed in to change notification settings - Fork 8
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
Demo Site: don't exclude middleware for /api/... requests #3086
Conversation
- The api requests are technically located under a specific domain (host) like any other page, so it is not wrong to have a domain param - the currently implemented api routes don't use the domain param though (other added apis might tough) - this solves errors rendering not-found in /api/..., as the not-found page accesses the domain param
How does this work with the preview domain? |
it doesn't. Ideas to fix this:
any other ideas? Is it generally a better idea than your fix? |
Yes, I think so. What about:
So we get rid of the I could make a PR for that. |
yes, that would work - and the /api in the url is not really neccasary. I'll do that in this PR.
I would not try to do that, having different /api routes is quite common. (for example in "a recent big customer project version 7" we have 6 api routes (+status and site-preview)) |
…leware like block-preview
bb62c04
to
427d233
Compare
Quality Gate failedFailed conditions |
Next.js suggest having api folders co-located to the page it is used (https://nextjs.org/docs/app/building-your-application/routing/route-handlers), this has several advantages (see also #2987). So I'm not convinced keeping /api as best practice. |
while I fully support co-located api, this is especially for our use cases often not possible:
|
Convinced. I'll update vivid-planet/comet-starter#622 according to this PR. |
alternative to vivid-planet/comet-starter#622
This PR moves the api routes from
src/app/api
intosrc/app/[domain]/api
.