graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

[improvement] Reload server after change

Open nemonemi opened this issue 4 years ago • 4 comments
trafficstars

Is your feature request related to a problem? Please describe.

Currently, after every change, for example in the .yaml file, the mesh serve has to be restarted for the change to be applied.

Describe the solution you'd like

With each change the changes to be persisted.

nemonemi avatar Apr 06 '21 09:04 nemonemi

Surely this can be baked into the serve command for convenience.

However, in the meantime, you can simply implement this with nodemon. You could take inspiration from the following command to be configured in your package.json

   "dev": "nodemon -e js,graphql,yaml --exec graphql-mesh serve"

You'd just need to install nodemon as a dev dependency.

santino avatar Apr 06 '21 10:04 santino

Thanks, @santino, however, the changes are detected for the files other than yaml. I've achieved it by explicitly watching the changes in the .meshrc.yaml file. e.g. "nodemon -e ts,graphql -w .meshrc.yaml --exec mesh serve"

As we've both agreed, this should be baked into the serve command for convenience. On top of that, the improvement would be that the currently opened graphiql is reloaded (it would be great if it would be hot reloaded), and not opened in a new tab.

nemonemi avatar Apr 06 '21 12:04 nemonemi

@Urigo could reloading server after file changes be achieved on the library level?

nemonemi avatar May 18 '21 15:05 nemonemi

Hi there, just a little observation: In my case, I was using the .meshrc.yaml and by being a hidden file (mind the dot at the beginning) the nodemon that works for me is explicitly calling that file, given that nodemon doesn't watch hidden files by default.

ie.: "dev": "nodemon --watch .meshrc.yaml --exec mesh dev" in your scripts's package.json.

Hope helps someone.

kyuumeitai avatar Apr 25 '22 16:04 kyuumeitai