frankcollins3 / PHPokedex

react concepts
0 stars 0 forks source link

graphQL schema mutations [6:05pm] #14

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

Error: Must provide name. at devAssert (/Users/medium/Desktop/phpokedex/frontend/pokedex/node_modules/graphql/jsutils/devAssert.js:12:11) at assertName (/Users/medium/Desktop/phpokedex/frontend/pokedex/node_modules/graphql/type/assertName.js:19:44) at new GraphQLObjectType (/Users/medium/Desktop/phpokedex/frontend/pokedex/node_modules/graphql/type/definition.js:680:44) at file:///Users/medium/Desktop/phpokedex/frontend/pokedex/server.js:89:26 at ModuleJob.run (internal/modules/esm/module_job.js:183:25) at async Loader.import (internal/modules/esm/loader.js:178:24) at async Object.loadESM (internal/process/esm_loader.js:68:5) at async handleMainPromise (internal/modules/run_main.js:59:12) [nodemon] app crashed - waiting for file changes before starting...

frankcollins3 commented 1 year ago

TypeError: Class constructor GraphQLNonNull cannot be invoked without 'new' at fields (file:///Users/medium/Desktop/phpokedex/frontend/pokedex/server.js:97:27) at resolveObjMapThunk (/Users/medium/Desktop/phpokedex/frontend/pokedex/node_modules/graphql/type/definition.js:504:40) at defineFieldMap (/Users/medium/Desktop/phpokedex/frontend/pokedex/node_modules/graphql/type/definition.js:766:20) at GraphQLObjectType._fields (/Users/medium/Desktop/phpokedex/frontend/pokedex/node_modules/graphql/type/definition.js:691:26) at GraphQLObjectType.getFields (/Users/medium/Desktop/phpokedex/frontend/pokedex/node_modules/graphql/type/definition.js:710:27) at collectReferencedTypes (/Users/medium/Desktop/phpokedex/frontend/pokedex/node_modules/graphql/type/schema.js:387:51) at new GraphQLSchema (/Users/medium/Desktop/phpokedex/frontend/pokedex/node_modules/graphql/type/schema.js:183:7) at file:///Users/medium/Desktop/phpokedex/frontend/pokedex/server.js:109:16 at ModuleJob.run (internal/modules/esm/module_job.js:183:25) at async Loader.import (internal/modules/esm/loader.js:178:24) [nodemon] app crashed - waiting for file changes before starting...

constructor issue

new GraphQLNonNull word new is needed.

[6:35pm]

frankcollins3 commented 1 year ago

Screen Shot 2023-05-08 at 7 44 48 AM

const pokemon = [ { id: 1, name: 'bulbasaur' }, { id: 2, name: 'ivysaur' }, { id: 3, name: 'venusaur' }, { id: 4, name: 'charmander' }, { id: 5, name: 'charmeleon' }, { id: 6, name: 'charizard' }, { id: 7, name: 'squirtle' }, { id: 8, name: 'wartortle' }, { id: 9, name: 'blastoise' } ]

^ ^ array of objects in index.js testing buildschema in: GraphiQL -> localhost:5000/graphql next is to test reading and writing to data sources like state or postgres DB with data from the pokeAPI.co

this video from web dev simplified helped me get going bookmarking that I never used chatGPT for javascript but it helped me a good bit to learn C and linked list. I was using chatGPT to learn graphql and it's very difficult. I also tried to get it to help me link express && react

given all of the files linked together in express, chatGPT was of no help unlike its ability to tend to situations in a single file like: (main.c file) programming

https://www.youtube.com/watch?v=ZQL7tL2S0oQ

[7:45am]