Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to write custom resolvers in JavaScript #280

Open
slava-vishnyakov opened this issue Sep 21, 2021 · 3 comments
Open

Ability to write custom resolvers in JavaScript #280

slava-vishnyakov opened this issue Sep 21, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@slava-vishnyakov
Copy link
Contributor

I think that could be pretty useful too

Thank you!

@slava-vishnyakov slava-vishnyakov added the enhancement New feature or request label Sep 21, 2021
@dosco
Copy link
Owner

dosco commented Sep 22, 2021

We support custom javascript scripting with the @script directive. It won't be too hard to extend that same code to build custom resolvers in JS. The core package has support for you to add custom resolvers in Go currently we have one for remote apis. I think adding another JS one can be done. https://github.com/dosco/graphjin/wiki/Guide-to-GraphQL#adding-business-logic-with-javascript

@dosco
Copy link
Owner

dosco commented Sep 22, 2021

Here's some example code for a custom redis resolver. https://pkg.go.dev/github.com/dosco/graphjin/core#Resolver

@slava-vishnyakov
Copy link
Contributor Author

Thank you for considering this!

I meant more like adding JS resolvers without having to compile GraphJin, i.e. by adding some configuration like "resolver (for something) is redisResolver-1.0.js" and then redisResolver-1.0.js is a file with some function (or better yet a class, so that you can have some persistent connection), which does all the heavy lifting.

That way people only with JS knowledge (or those who use standalone binary) will be able to add them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants