Closed frankcollins3 closed 1 year ago
handwritten function it is.
[8:55pm]
used the same function from client/src/utility in /server/index.js. endpoints to access (pokemon.type)// pokemon.types[0||1].type.name is at the /api/pokemon route not /api route (pokeAPI) [10:26am]
import axios from 'axios' **here is a /utility function that takes param of key which would be {int:id} || {string:name} ***
here is that function imported and then put as the value for a {getAllData:} key. import nameOrIdForData from '../../utility/nameOrIdForData' import axios from 'axios'
const firefunc = async () => { let myData = await nameOrIdForData(88); // console.log('myData') console.log(myData)
}
my issue/blocker is now how to send over that function while passing constraint of needing to apply to one of these imports.
first proposed approach: perhaps GraphQLObjectType would work but if not maybe there is another one of those imports that would allow for that.
another approach is that its not the end of world to hand write that very simple function that returns all data for params in the server so that it is used in the GraphQL route without need to be imported (because it cant its outside of /src) and cant be snuck through a POST data call with the function as post body data as far as I can say.
server side that function would be retrieved from req.body.getAllData if not mistaken
[8:46pm]