next-runtime icon indicating copy to clipboard operation
next-runtime copied to clipboard

feat: split api routes into separate functions

Open ascorbic opened this issue 1 year ago โ€ข 16 comments

Summary

Rather than including API routes in the SSR function, this splits them into individual functions per route. This makes them smaller, easier to track in the UI, and enables them to be configured individually.

Test plan

  1. Visit the Deploy Preview
  2. Open the API route examples

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

Standard checks:

  • [ ] Check the Deploy Preview's Demo site for your PR's functionality
  • [ ] Add docs when necessary

๐Ÿงช Once merged, make sure to update the version if needed and that it was published correctly.

ascorbic avatar Jul 31 '22 06:07 ascorbic

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

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/634d839bd7f54700084d2a76
Deploy Preview https://deploy-preview-1495--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.

netlify[bot] avatar Jul 31 '22 06:07 netlify[bot]

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

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/634d839ba18ea400092e4343
Deploy Preview https://deploy-preview-1495--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[bot] avatar Jul 31 '22 06:07 netlify[bot]

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

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/634d839ba787480008f4d097
Deploy Preview https://deploy-preview-1495--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[bot] avatar Jul 31 '22 06:07 netlify[bot]

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

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/634d839b9bea8e0009c9c9e8
Deploy Preview https://deploy-preview-1495--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.

netlify[bot] avatar Jul 31 '22 06:07 netlify[bot]

Deploy Preview for next-hp-edge-demo ready!

Name Link
Latest commit 898a8a7847996ad7ebfe1ea169d00c81a778a828
Latest deploy log https://app.netlify.com/sites/next-hp-edge-demo/deploys/633ff3cfc903030009ddbf4a
Deploy Preview https://deploy-preview-1495--next-hp-edge-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[bot] avatar Jul 31 '22 06:07 netlify[bot]

Deploy Preview for next-plugin-rsc-demo ready!

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/next-plugin-rsc-demo/deploys/634d839b7366320008ced7b1
Deploy Preview https://deploy-preview-1495--next-plugin-rsc-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[bot] avatar Jul 31 '22 06:07 netlify[bot]

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

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/634d839b5cb15c00098c9f3e
Deploy Preview https://deploy-preview-1495--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[bot] avatar Jul 31 '22 06:07 netlify[bot]

Deploy Preview for next-i18next-demo ready!

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/634d839b89d8700009d14b24
Deploy Preview https://deploy-preview-1495--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[bot] avatar Jul 31 '22 06:07 netlify[bot]

Deploy Preview for next-plugin-canary ready!

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/634d839b414f1a000802fa18
Deploy Preview https://deploy-preview-1495--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[bot] avatar Jul 31 '22 06:07 netlify[bot]

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

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/634d839b9775ac0008e88cc7
Deploy Preview https://deploy-preview-1495--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[bot] avatar Jul 31 '22 06:07 netlify[bot]

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

Name Link
Latest commit 781be0cee758beb3436efc2eef3fd2cf1c014078
Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/634d839b23e05f00080e06f0
Deploy Preview https://deploy-preview-1495--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[bot] avatar Jul 31 '22 06:07 netlify[bot]



Test summary

22 โ€ข 2 โ€ข 0 โ€ข 0


Run details

Project netlify-plugin-nextjs-default-demo
Status Failed
Commit 2b22248167 โ„น๏ธ
Started Aug 8, 2022 10:54 AM
Ended Aug 8, 2022 10:56 AM
Duration 01:32 ๐Ÿ’ก
OS Linux Ubuntu - 20.04
Browser Chrome 103

View run in Cypress Dashboard โžก๏ธ


Failures

preview.spec.ts 1ย Failed
1 Preview Mode > enters and exits preview mode
api.spec.ts 1ย Failed
1 Extended API routes > returns 404 for scheduled route

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

cypress[bot] avatar Jul 31 '22 06:07 cypress[bot]



Test summary

2 โ€ข 0 โ€ข 0 โ€ข 0


Run details

Project netlify-plugin-nextjs-nx-monorepo-demo
Status Passed
Commit 2b22248167 โ„น๏ธ
Started Aug 8, 2022 10:55 AM
Ended Aug 8, 2022 10:56 AM
Duration 01:10 ๐Ÿ’ก
OS Linux Ubuntu - 20.04
Browser Chrome 103

View run in Cypress Dashboard โžก๏ธ


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

cypress[bot] avatar Jul 31 '22 06:07 cypress[bot]



Test summary

7 โ€ข 0 โ€ข 0 โ€ข 0


Run details

Project netlify-plugin-nextjs-static-demo
Status Passed
Commit 2b22248167 โ„น๏ธ
Started Aug 8, 2022 10:54 AM
Ended Aug 8, 2022 10:56 AM
Duration 01:19 ๐Ÿ’ก
OS Linux Ubuntu - 20.04
Browser Chrome 103

View run in Cypress Dashboard โžก๏ธ


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

cypress[bot] avatar Jul 31 '22 06:07 cypress[bot]

It looks like the demo site for the split API routes is failing @ascorbic.

5:40:25 AM: Error: > Couldn't find a `pages` directory. Please create one under the project root
    at Object.findPagesDir (/opt/build/repo/node_modules/next/dist/lib/find-pages-dir.js:42:19)
5:40:25 AM:     at /opt/build/repo/node_modules/next/dist/build/index.js:95:70
5:40:25 AM:     at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
5:40:25 AM:     at async Object.build [as default] (/opt/build/repo/node_modules/next/dist/build/index.js:65:29)

nickytonline avatar Oct 13 '22 15:10 nickytonline

@nickytonline you have two copies of the plugin in your site. You need to disable to auto-installed one.

ascorbic avatar Oct 14 '22 08:10 ascorbic