Fork me on GitHub
#graphql
<
2018-09-28
>
lilactown00:09:18

are there any diagrams or docs for the interceptor flow that lacinia-pedestal implements outside of the API docs?

orestis09:09:04

I’m having a similar question — I’d like to include lacinia-pedestal’s interceptors as part of another service map and routes. So /graphql, /graphql-ws and /_graphiql would be just 3 routes inside a much larger route specification. I’d also like to add my own interceptors (e.g. authentication, rate limiting and so on) in front of them. What is the recommended way to do that?

lilactown15:09:23

yeah, that's how I've been trying to piece it together

lilactown15:09:40

I haven't gotten to actually reading the code but I think that's what I'm going to have to do

lilactown15:09:16

I was thinking of adding a transformation stage, so that a resolver could return a query and then it's children could manipulate the query, before doing the actual GraphQL JSON stage

hlship20:09:16

It's grown a bit haphazardly from specific code needed to setup for our own servers, to something more general that can be used a bit piecemeal to setup something else. So there's the simple route, just use service-map or the intermediate approach (pass some options to service-map) or the heavy approach: reuse bits and pieces of code called from service-map.

hlship20:09:12

All the business about interceptors and inject is so that if you make a change to the lacinia-pedestal interceptor chain for release N, when you upgrade to N+1 your changes should still work, even if lacinia-pedestal has added new interceptors to its default chain.

orestis21:09:04

Thanks! Nice to know the reasoning about things.