Davide-Gheri / nestjs-mercurius

NestJs module to use Mercurius as GraphQL server
MIT License
40 stars 7 forks source link

Other Mercurius plugins.... #295

Open smolinari opened 2 years ago

smolinari commented 2 years ago

Hey,

is it possible to add other plugins for Mercurius? I'm interested in the auth, cache and validation plugins. I see the upload and altair plugins are hardcoded. Maybe plugins could be made to be pluginable 😀?

Scott

smolinari commented 2 years ago

Actually, I'm tending towards just creating a guard within Nest for Authorization. I'm already using a guard for Authentication. Validation can be handled in Nest too. That leaves just cache (currently) that I am interested in adding.

Scott

Davide-Gheri commented 2 years ago

Hey!

yes I saw the mercurius cache plugin and it is quite interesting, we could easliy add a plugins option that simply register the passed plugins to the Fastify instance, but it will be just a "shortcut" to manually call app.register since they are nothing more than Fastify plugins!

smolinari commented 2 years ago

Whatever you think is best. I'm glad for anything you can get done. :)

Scott

Davide-Gheri commented 2 years ago

Hi @smolinari currently I don't have much time to handle this, but PRs are welcome!

smolinari commented 2 years ago

I'm a bit tight on time right now too. And currently I'm happy and I need to concentrate on testing for my project. Maybe I can do something in January on this, as I'm very interested in the cache plugin. I'll probably just follow what you have already done in this respect. If more plugins become available and more flexibility is needed, we can change the API.

Scott