Is there any particular reason `GraphQLServerLamb...
# orm-help
l
Is there any particular reason
GraphQLServerLambda
does not have middleware property? Makes reuse difficult
d
Just noticed an issue that tracks this https://github.com/prismagraphql/graphql-yoga/issues/398 @matic: Implemented it, maybe you have more insights 🙂
d
GraphQLServerLambda
wraps
apollo-server-lambda
which does not use express.
l
Is there an alternative?
d
The middleware property is a shortcut to apply express middleware.
Not use Lambda?
Or just use the normal GraphqlServer with express: https://github.com/awslabs/aws-serverless-express
I'm not entirely sure how you do it, but I figure it shouldn't be too hard.
l
Can have a look
Bit of a pointless thing
GraphQLServerLambda
then
d
Not really. It implements the Lambda pattern, which does not need a server like express or hapi.
l
All I need is code to run before resolvers, extracting the userId from the token, also use graphql-shield
d
As Lambda is really intended for serverless functions, as soon as you start adding servers, middleware etc., perhaps you might consider some alternatives.
👍 1
l
Could wrap the resolvers to run the "middleware"
d
userID from token you can do without midleware. But graphql-shield - yeah you will need express in there somewhere.