Search code examples
apollo-servervscode-debuggertypegraphql

How can I debug my typegraphql resolvers in VS Code?


so I got my typeorm, typegraphql, apollo-server-express, typescript endpoint up and running with resolvers, mutations and all that stuff.

Having a c# background I sometimes want to debug my endpoint when making requests to the playground to figure out what I'm doing wrong. I haven't found a setup in which vscode allows me to do that, also google wasn't much of a help.

Is it possible what i'm trying to achieve? Thanks


Solution

  • I made it using the following launch.json, maybe this helps someone else

    {
        "version": "0.2.0",
        "configurations": [
            {
              "name": "Example",
              "type": "node",
              "request": "launch",
              "runtimeExecutable": "node",
              "runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
        
              "args": ["src/index.ts", "--transpile-only", "hello"],
              
              "cwd": "${workspaceRoot}",
              "internalConsoleOptions": "openOnSessionStart",
              "skipFiles": ["<node_internals>/**", "node_modules/**"]
            }
          ]
      }