-
Notifications
You must be signed in to change notification settings - Fork 86
feat: provide display name for split api routes #2155
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
Conversation
✅ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-edge-middleware ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for nextjs-plugin-custom-routes-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-canary ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-i18next-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-export-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Description
This PR updates how API Routes are named + displayed when the Split-API-Routes flag is enabled.
Before, the generated API-Routes were named
_api-0
to_api-n
, and there were no display names. Now, the names are a bit more complicated, but easier to understand as well. They take into account that some lambdas serve multiple API routes, while others serve only a single one.In the new logic, those "singleton lambdas" are named based on their page name (
/api/shows/[:id]
becomes_api_shows_id-handler
) and receive a display name that shows their route (Next.js API handler /api/shows/[:id]
). Scheduled functions and background function have that exact same naming convention, we'll rely on the UI-displayed badge to signal that those are special functions.For "packed lambdas", which serve multiple API routes, we use simpler names. If there's only one big packed lambda, then we'll name it
___netlify-api-handler
, similar to the existing___netlify-handler
and___netlify-odb-handler
. We'll give it the display-nameNext.js API handler
, similar to the existingNext.js SSR handler
.If there's multiple packed lambdas because one wasn't big enough, then we enumerate them from
___netlify-api-handler-1
to___netlify-api-handler-n
with the display namesNext.js API handler 1/n
toNext.js API handler n/n
.Documentation
Tests
added a unit test.
Relevant links (GitHub issues, etc.) or a picture of cute animal
came up in https://netlify.slack.com/archives/C053SCS9GDQ/p1685732487867909