2

I am trying to setup an apollo project to learn a bit how it works.

I downloaded graphQL nodeJS template from node-graphql-server

I setup a simple angular9 application using apollo-angular

I run the server, and I wanted to autogenerate the type in my angular app.

I ran the code command

apollo codegen:generate --endpoint=http://localhost:500/ --target=typescript --globalTypesFile=./src/app/__generated__/globalTypes.ts

  × Generating query files with 'typescript' target
    → No operations or fragments found to generate code for.
Error: No operations or fragments found to generate code for.
    at write (C:/Users/feder/AppData/Roaming/npm-cache/_npx/3188/node_modules/apollo/lib/commands/client/codegen.js:72:39)
    at Task.task (C:/Users/feder/AppData/Roaming/npm-cache/_npx/3188/node_modules/apollo/lib/commands/client/codegen.js:98:46)

I tried to setup some

But I keep getting apollo.config.js

module.exports = {
    client: {
      includes: [__dirname+'/src/graphql/**'],
      service: {
        name: "localhost",
        url: "https://localhost:500",
      }
    }
}

and played with the command, but I keep getting the same error over and over.

How can I generate the server types ?

Bobby
  • 4,372
  • 8
  • 47
  • 103

2 Answers2

0

I have encountered similar issue when I placed the project inside the folder with the "hash" symbol '#test_folder'. Once I changed that, project was generating as expected.

J.Loscos
  • 2,478
  • 1
  • 10
  • 17
Oggie
  • 1
  • 1
0
"npx apollo client:codegen --localSchemaFile=schema.json --includes=src/**/*.tsx --target=typescript"
emekcan99
  • 1
  • 1
  • try this in your terminal – emekcan99 Aug 25 '22 at 15:11
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](https://stackoverflow.com/help/how-to-answer). – Tyler2P Aug 28 '22 at 17:18