Skip to content

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

Merged
merged 3 commits into from
Jun 12, 2023

Conversation

Skn0tt
Copy link
Contributor

@Skn0tt Skn0tt commented Jun 6, 2023

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-name Next.js API handler, similar to the existing Next.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 names Next.js API handler 1/n to Next.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

@Skn0tt Skn0tt requested a review from a team as a code owner June 6, 2023 12:25
@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

Name Link
🔨 Latest commit 5f5199c
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/64870ca2948bb000070be954
😎 Deploy Preview https://deploy-preview-2155--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

Name Link
🔨 Latest commit 5f5199c
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/64870ca2b690960008af9ab8
😎 Deploy Preview https://deploy-preview-2155--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for next-plugin-edge-middleware ready!

Name Link
🔨 Latest commit 5f5199c
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/64870ca28dce300008b346c4
😎 Deploy Preview https://deploy-preview-2155--next-plugin-edge-middleware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jun 6, 2023
@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!

Name Link
🔨 Latest commit 5f5199c
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/64870ca2e8883c0007182f98
😎 Deploy Preview https://deploy-preview-2155--netlify-plugin-nextjs-next-auth-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for netlify-plugin-nextjs-demo ready!

Name Link
🔨 Latest commit 5f5199c
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/64870ca29aed2a00088d4f3e
😎 Deploy Preview https://deploy-preview-2155--netlify-plugin-nextjs-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for nextjs-plugin-custom-routes-demo ready!

Name Link
🔨 Latest commit 5f5199c
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/64870ca209b4df0008dc5498
😎 Deploy Preview https://deploy-preview-2155--nextjs-plugin-custom-routes-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit 5f5199c
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/64870ca2d5c56c0008b89f3b
😎 Deploy Preview https://deploy-preview-2155--next-plugin-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit 5f5199c
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/64870ca2327eef00092c2051
😎 Deploy Preview https://deploy-preview-2155--next-i18next-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit 5f5199c
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/64870ca2616bf900084b4c62
😎 Deploy Preview https://deploy-preview-2155--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@kodiakhq kodiakhq bot merged commit 10250a0 into main Jun 12, 2023
@kodiakhq kodiakhq bot deleted the split-api-routes-displayname branch June 12, 2023 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants