You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In theory Next.js API Routes are analogous to Resource Routes and Service Side Props to Loaders so a lot of the concepts already present should translate.
The text was updated successfully, but these errors were encountered:
That's a great suggestion 🙌 , I do think with Remix moving to vite this could become pretty convenient as we have already explored vite in #79. We can use import.meta.glob to add the schema-types declared in the types/ directory and create a way to initialise the resource route.
The exploration after that would be how it look on the client-side, I personally don't have too much experience with Remix so I'm going to have to do some reading at first before I can participate in discussing how this API surface looks.
For generating the client-side types I reckon that we can hook into the vite plugin lifecycle to boot the code-generator.
EDIT: when looking into this I would probably build support out for vite, it looks like there aren't many folks running GraphQL servers/... in resource-routes. Will need to check how their signature works. That being said with the standalone we might be able to do fuse build --watch and import that output in the service-route given a custom adapter that exports loader/action for remix 😅 or use fuse dev and call out to the endpoint generated by that, that way they can be deployed independently and it will be easier to scale to multiple devices.
Yup, Remix moving to vite is a massive enabler for automatic generation (and also other non-remix projects). I've been using this vite graphql codegen plugin with Pothos in a side project and it works pretty well. So would love to drop all that glue for an opinionated solution! As a bonus, Remix is considering RSC so should align on that goal eventually too.
Summary
Official request for Remix support.
Proposed Solution
In theory Next.js API Routes are analogous to Resource Routes and Service Side Props to Loaders so a lot of the concepts already present should translate.
The text was updated successfully, but these errors were encountered: