Skip to content

fix: support api routes at index of folder #2101

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 4 commits into from
May 11, 2023
Merged

fix: support api routes at index of folder #2101

merged 4 commits into from
May 11, 2023

Conversation

RohitRajendran
Copy link

@RohitRajendran RohitRajendran commented May 11, 2023

Summary

Adds support to getSourceFileForPage to be able to find file when it is an index file of a folder.

Test plan

  1. It should be tested with a NextJS config that has an api folder structure similar to /api/test/index.ts

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

fixes #2100

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality

🧪 Once merged, make sure to update the version if needed and that it was published correctly.

@netlify
Copy link

netlify bot commented May 11, 2023

👷 Deploy request for netlify-plugin-nextjs-nx-monorepo-demo pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2b886a0

@netlify
Copy link

netlify bot commented May 11, 2023

👷 Deploy request for netlify-plugin-nextjs-static-root-demo pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2b886a0

@netlify
Copy link

netlify bot commented May 11, 2023

👷 Deploy request for netlify-plugin-nextjs-next-auth-demo pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2b886a0

@netlify
Copy link

netlify bot commented May 11, 2023

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

Name Link
🔨 Latest commit 2b886a0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/645ce2a19421790008664beb
😎 Deploy Preview https://deploy-preview-2101--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
Copy link

netlify bot commented May 11, 2023

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

Name Link
🔨 Latest commit 2b886a0
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/645ce2a1edd2f50008d6b6df
😎 Deploy Preview https://deploy-preview-2101--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
Copy link

netlify bot commented May 11, 2023

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit 2b886a0
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/645ce2a1b98fb5000845332c
😎 Deploy Preview https://deploy-preview-2101--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 May 11, 2023

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit 2b886a0
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/645ce2a18601c80008026ea6
😎 Deploy Preview https://deploy-preview-2101--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 May 11, 2023

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

Name Link
🔨 Latest commit 2b886a0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/645ce2a1d6ea6900081e0acc
😎 Deploy Preview https://deploy-preview-2101--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 May 11, 2023

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

Name Link
🔨 Latest commit 2b886a0
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/645ce2a18601c80008026eab
😎 Deploy Preview https://deploy-preview-2101--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.

@RohitRajendran RohitRajendran marked this pull request as ready for review May 11, 2023 02:39
@RohitRajendran RohitRajendran changed the title Support api routes at index of folder fix: support api routes at index of folder May 11, 2023
Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @RohitRajendran!

@pieh pieh added the automerge label May 11, 2023
@kodiakhq kodiakhq bot merged commit cc9ed84 into opennextjs:main May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Could not find source file for page /api/ when index file for the folder
2 participants