3 ms·
Stop building REST APIs for your Next.js apps, use tRPC instead
- deleted 5y ago[deleted]
- john_the_writer 5y agoI sort of wonder what happens when you use that API on a different language. Like if you spend the time building trpc, and then decide to allow a Droid to use your api do you have to create a new api? What if you have an untyped language interact with it? Like what if you build this API out and then add/build an admin site in rails, but it uses the API? Now you may say, we're never going to need to worry about that. If javascript has taught me anything it's that Javascript practices change really fast. I still have maintain coffee script, jquery and backbone from time to time. :) I don't want to have to maintain two different versions of the API.. and the one thing I can say about REST.. it's worked for a very long time.
- iansinnott 5y agoCould definitely do it without writing a new API, but there would be some difficulty. By default requests simply run over HTTP, however, the default transformer used is implemented in JS. You'd need to make sure req/res bodies were properly transformed. Haven't looked into it much but I suspect it would not be too difficult to use a language agnostic(-ish) transformer that would support Java/Swift/JS. edit: spelling