I have NextJs front from which i need to do calls to external python api. I'm new to Next and i just found out that there is integrated api (by creating folders app/api/resource/route). So what is the proper way to call external resource?
Do it just using fetch/axios as you'd did it in react?
Call NextJs's integrated api and then redirect from that to external?
Does second variant make any sense at all or am I tweakin?
You can evaluate both options by looking at their pros and cons.
You should use API routes if you are accessing some resources that you don't want to be exposed to on the client side or if you want to do any background work.
You can go with Axios/fetch if you don't have any resources to hide and don't want to add a layer of API routes and processing. Both options have their pros and cons; you can refer to some guides about that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With