Keeping vercel API routes synchronized
has anyone using vercel serverless functions figured out a good way to somehow keep axios/fetch calls to those endpoints in sync with the file paths?
routes for the functions are based on filepath, so pages/api/my-route.ts resolves to URL/api/my-route
6 Replies
GitHub
GitHub - TheDevMinerTV/typed-at-rest: Simple typesafe HTTP handlers...
Simple typesafe HTTP handlers and clients backed by @effect/schema - GitHub - TheDevMinerTV/typed-at-rest: Simple typesafe HTTP handlers and clients backed by @effect/schema
there was a pages dir lib for that as well, but was more focused into swr/rq
the next-typesafe-url looks relaly good but then i see
Finally, we just need to run the cli to generate some code
typed-at-rest
seems really immatureim the creator of next-typesafe-url
nextjs uses file system routing so its not possible to get typed routing without some code gen
let me know if you have any other questions im happy to help
@whatplan (Rustular Devrel) i decided to just go with this approach. a unit test
and i define my types elsewhere. i guess im allergic to code gen