I am new to Node. I saw many examples on Rapid API where we use the axios package to make requests to an API. But we can also do the same with fetch method in JavaScript frontend. So should I make API requests from frontend JavaScript using fetch or should I use my backend to make API requests using axios?
Thank you in advance for any help!
1)Axios has url in request object while Fetch has no url in request object.
2)Axios is a stand-alone third party package that can be easily installed while Fetch is built into most modern browsers no installation is required as such.
3)Axios enjoys built-in XSRF protection but Fetch does not.
4)Axios uses the data property while Fetch uses the body property.
5)Axios data contains the object while Fetch’s body has to be stringified
6)Axios has the ability to intercept HTTP requests but Fetch, by default, doesn’t provide a way to intercept requests.
Go through this article and you will understand https://www.geeksforgeeks.org/difference-between-fetch-and-axios-js-for-making-http-requests/