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

Usage with lacinia-pedestal #1

Open
bday2009 opened this issue Dec 12, 2020 · 3 comments
Open

Usage with lacinia-pedestal #1

bday2009 opened this issue Dec 12, 2020 · 3 comments

Comments

@bday2009
Copy link

bday2009 commented Dec 12, 2020

Hello, thank you for this library. I'm using superlifter to handle batching for my lacinia GraphQL server and I'd like to compare the two libraries. lacinia provides lacinia-pedestal to quickly hook up a pedestal service for GraphQL. I'm looking at the documentation of tako and I'm not sure how to clean up the loaders using lacinia-pedestal, as it does not use lacinia/execute function.
From looking at lacinia-pedestal source code I thought this would be the place to do that: https://github.com/walmartlabs/lacinia-pedestal/blob/master/src/com/walmartlabs/lacinia/pedestal/internal.clj#L198
So maybe:

(defn ^:private execute-query
  [context]
  (let [request (:request context)
        {q :parsed-lacinia-query app-context :lacinia-app-context} request
        result (executor/execute-query
                 (assoc app-context constants/parsed-query-key q))]
    ;; clean up here
    result))

Then replace the interceptor with enter fn here: https://github.com/walmartlabs/lacinia-pedestal/blob/master/src/com/walmartlabs/lacinia/pedestal/internal.clj#L206

What do you think? Maybe tako can provide an utility function to set this up quickly?

@gnarroway
Copy link
Owner

Hi there, thanks for discovering my library and trying to try it out :)

I’ve only used it with lacinia/ring/jetty so far but seeing how it could work with pedestal would be interesting. Thank you for your suggestions.

I am going to flesh out the docs a bit more and also knock up some concrete example apps as it’s probably easier to understand how to hook it up. I will check out lacinia-pedestal during this exercise.

@bday2009
Copy link
Author

That would be very cool. Thank you!

@gnarroway
Copy link
Owner

Hi @bday2009,

I added a section on how to use this with pedestal. Let me know if it works for you.

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

No branches or pull requests

2 participants