External apis calls

is there any way or tutorial available by which we can call an external API using 8base backend?

for example I m currently working on a crypto app the app will have a button to connect to exchange, the app will call 8base end point which in turn calls the exchanges api and gets the information stores the information and exposes through 8base graph ql api?

Hey @humayuntanwar - so funny I literally recorded this tutorial yesterday and it’s not in production. It will be released in the upcoming weeks. However, in the meantime, I’d try this.

Install an HTTP client, like axios.

npm install --save axios

Inside your function, use it to make API calls to 3rd party APIs.

const axios = require(axios)


export default async function(event, ctx) {
  const response = await axios.get('https://someapi.com/exchange')

  return {
    data: response.data
  }
}

In terms of integrating this into the GraphQL API, you’d want to be generating a resolver function. Here are resources for resolver functions:

docs: Resolvers - 8base Documentation
video: 8base Academy - Resolver Function Basics for extending the GraphQL API - Course 5 - YouTube
tutorial: Combine REST APIs in GraphQL Using 8base (with Sebastian Scholl) — Learn With Jason - YouTube

Hope these help!