What is the best way to make requests to a external api with Next?
I have a nodejs server and would like to make requests from a next application.
I read about Route handlers, but I don't know if it's the best strategy and how to implement it
7 Replies
wouldn't fetch work?
I think I'm a little confused. Normally, using react I would create an instance of axios and split the requests into files. With next can I do the same process? Considering requests made by the server
Overthinking it, just fetch it
2 much think +1
Its just fetches and maybe validation using zod if you want to be extra sure
Its the same procedure for fetching in client side apps and server side. The difference being the server is the one making the request rather then the client. It doesn't really matter tho
Just invoke it where you need it
What's the reason behind parseAsync and not just parse? So return can be caught instead of a try catch block?
No real reason
Atleast in my use case
Thanks guys!