Is it possible to consume an API with express?

Asked

Viewed 53 times

-4

I have a problem, I Wanted to create an API with express to consume Another API, but I don’t know how to do it ... Could you help me?

  • This is the stackoverflow in English.

1 answer

-2


Being quite direct, yes, it is possible to consume a Rest API using Express, you will not well consume the API with Express, but with libraries to make requests, such as Axios for example. So if your idea is: I’m using Framework Express, and I want to use an external API somehow in my application, the answer is yes, it’s possible.

Now that comes the pores and variants:

What API is this?
Example: The Github API

What is your goal when using this API?
Example: I want to fetch user data for my application, or I want to use Github Uth for user authentication, etc.

There are these and many more questions you should ask yourself when consuming an API, but the main one you should have at hand is: your goal with this API, its documentation, and whether this API has an SDK for you to use with the language you are using.

You’ll get more details by asking a more specific question, so it’s up to you :)

  • I want to fetch user data from an external API (traccar api) for my application, using Next JS and then send this data to a server created with express. How can I do that?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.