Why am I receiving null value when I'm trying to fetch data from an external API?
This is my code
resolvers.js
import fetch from 'node-fetch'
export const resolvers = {
Query: {
getCrypto: async() => {
const response = await fetch(`https://min-api.cryptocompare.com/data/top/totalvolfull?limit=10&tsym=USD`)
return response.json();
}
},
};
schema.grapqhl
type CryptoCurrency {
Id: ID
Name: String
FullName: String
PRICE: Float
LASTUPDATE: Float
}
type Query {
getCrypto: CryptoCurrency
}
Screenshot of the error: