Hi! I'm wondering if exist a grapqhql example? And...
# help
m
Hi! I'm wondering if exist a grapqhql example? And if I should do all the business logic in the same grapqh lambda or in different lambdas.
o
I have my graphql API in a single lambda, but all my business logic is housed in libraries which I call commands (getUser, suspendUser, reIndexUser etc). The graphql lambda mainly focuses on authorisation, mapping graphql inputs to command parameters, and formatting responses.
You can use
apollo-server-lambda
as a starting point
m
And do you know the tradeoff bewteen having all the business logic with graqhql in one lambda vs as you have?. One big cold start vs many litle cold start?
o
So far my api maybe isn’t big enough that code size is an issue for cold starts - I also use webpack (serverless-bundle), access databases over REST and use small specific libraries wherever possible to keep it manageable.
Oh and
serverless-plugin-lambda-warmup
m
nice thank you!