EricKit / nest-user-auth

A starter build for a back end which implements managing users with MongoDB, Mongoose, NestJS, Passport-JWT, and GraphQL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug with nodemon

marioteik opened this issue · comments

This project is restarting all the time when you use nodemon because of the graphql.clases.ts. You need to ignore it on nodemon.json or find another better solution.

Thanks for the feedback. I added comments to front page on how to fix this (I've never used nodemon, I like it!). It's above the GraphQL section. Let me know if this doesn't close your issue.

nodemon

To use nodemon you'll need to make a small change. In src/app.module.ts comment out the following

  definitions: {
    path: join(process.cwd(), 'src/graphql.classes.ts'),
    outputAs: 'class',
  },

Under Model Mangement, it describes how this app builds the classes from your GraphQL schema. This creates a new file, which causes nodemon to restart. When it restarts, it rebuilds the file, and continues to restart. If the schema is updated, uncomment these lines, let it run, then recomment them.

Hi, I did not see this comment early, sry.

Nodemon is pretty common. Nestjs puts it in the projetc, so I think the solution should be to ignore the changes on 'graphql.classes.ts'. It's very handy the definitions generated in this file and your IDE should handle these updates on the fly, so ignoring changes on it doesn't affect the project at all and will help the development a lot.

My workaround was like this:

To use nodemon you'll need to make a small change. In 'nodemon.json' you should add "src/graphql.classes.ts" to ignore the changes on that file.

{
  "watch": ["src"],
  "ext": "ts,graphql",
  "ignore": ["src/**/*.spec.ts", "src/graphql.classes.ts"],
  "exec": "ts-node -r tsconfig-paths/register src/main.ts"
}

Anyway, good job on this project!

Perfect, made the change. Thanks!