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
Neto
Neto16mo ago
next-typesafe-url
next-typesafe-url
a search param and routing library for next.js
Neto
Neto16mo ago
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
Neto
Neto16mo ago
there was a pages dir lib for that as well, but was more focused into swr/rq
jakeleventhal
jakeleventhal16mo ago
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 immature
whatplan
whatplan16mo ago
im 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
jakeleventhal
jakeleventhal16mo ago
@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
Want results from more Discord servers?
Add your server