Netlify function for different api

Hi there,

May i know should I create each function for calling different api or can I combine both in one function?

example
Solution 1-
create function a to call api 1
create function b to call api 2

solution 2.
combine both call 2 api in one function

so which one should I do? If can do solution 2, how to combine in one handler?

Hi @Madmals , welcome to the community! :partying_face:

You can make multiple API calls from the same function, but for code maintainability and debugging, it is best to separate them into different functions.

As to how to combine functions, you could find inspiration from : Functions examples - Netlify Functions

Hope this helps!

hi, when I try to set up more than one function in my app the second function is never called so I decided to define all my API in one function and used else if statment to point to the right API. The issue is that only 2 API get called, the reste is never called.

I wonder if you have set up some l’imitation.

Thank u a lot.

Hi @samty

We do use rate limiting for our API. You can use the information in our documentation to check if you are hitting the limit.