frankcollins3 / PHPokedex

react concepts
0 stars 0 forks source link

scope of utility function && GraphQL [3:31pm] #34

Open frankcollins3 opened 1 year ago

frankcollins3 commented 1 year ago

I haven't been able to access the pokemon.type endpoint. Thats because there isn't one.

realized that to get the type is a pokemon.types[0].type.

I considered whether this would be the scope of some graphQL route that would fetch by /graphql?query={key{endpoint}} or whether calling the pokemonAPI would be a [src/utility] modular function.

func that this commit is about, returning the pokemon postgres db data through prisma ORM, is already GraphQL endpoint. I would be within the same rootQueryType. The default pokeAPI.co is the [api/pokemon] endpoint. not the [api/] endpoint. I have to call the API within this function that returns the API endpoints as specified by GraphQLObjectType.

first proposed approach: its not end of world to have an API data returning function in /utility folder.

Realize as writing this one could client side just do 2 separate GQL query.

[3:33pm]