Skip to content
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

Only keep a single route/method handler when scanning directories #806

Closed
1 task done
yassilah opened this issue Jan 6, 2023 · 0 comments · Fixed by #807
Closed
1 task done

Only keep a single route/method handler when scanning directories #806

yassilah opened this issue Jan 6, 2023 · 0 comments · Fixed by #807

Comments

@yassilah
Copy link
Contributor

yassilah commented Jan 6, 2023

Describe the feature

Right now, when using Nuxt layers to extend the server API endpoints, the "top-level" endpoints do not override "sub-level" endpoints; instead they're just being appended to the list of handlers. They're then being added to the server output file even though they will never be called as Nitro will first match the top-level handlers, which increases the file size and the transpiling process duration. A very simple fix would be to filter unique route/method pairs here to make sure only a single handler per route is being added:
https://github.com/unjs/nitro/blob/1c4d6e1fba7be6923e80cefbde541f47fc9582f2/src/scan.ts#L20

Additional information

  • Would you be willing to help implement this feature?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant