kravetsone / elysia-autoload

Plugin for Elysia which autoload all routes in directory and code-generate types for Eden
https://www.npmjs.com/package/elysia-autoload
56 stars 3 forks source link

Feature Request: Support Multiple Files for the Same Endpoint #21

Closed vastamaki closed 1 week ago

vastamaki commented 2 weeks ago

First off, thanks for the awesome work on this plugin!

I wanted to propose a feature that I believe would be really helpful, especially for those of us who prefer keeping each endpoint in a separate file. For example, it would be great to have something like:

I’m sure others could benefit from this flexibility too. Let me know if this is something you’d consider, or if there’s already a way to achieve this that I might have missed.

Thanks again for all your hard work! 🙌

rtritto commented 1 week ago

@kravetsone Any update? This feature will be very useful.

kravetsone commented 1 week ago

Solved by adding solid-start inspired renaming index syntax!

Ream more - https://docs.solidjs.com/solid-start/building-your-application/routing#renaming-index

image

Now you should do something like

rtritto commented 1 week ago

@kravetsone this plugin is generic (work only with Elysia) and isn't related to a specific web framework (like vike or solid-start). This feature is needed because improves all routes with the group hook of Elysia.

kravetsone commented 1 week ago

Solved by adding solid-start inspired renaming index syntax!

You didn't understand. I added (some).ts its inspired by solid-start

rtritto commented 1 week ago

Nvm, I misunderstood, in https://github.com/kravetsone/elysia-autoload/commit/0ddeb241c18883b950eb3672e81efe7af5fa2a0b you added:

    {
        regex: /\/?\((.*)\)/,
        replacement: "",
    },

Thanks!