GraphQL server on Lambda using Relay and Serverless

How can I go about created a GraphQL server on AWS lambda through serverless?

I looked at this: https://github.com/serverless/serverless-graphql-blog

but this has been made in nodejs v4 and serverless v0.5 which are quite old now.

I’ve written a few using http://graphql.org/graphql-js/. In a very simple implementation your handler just need to get the parameters from the event into the graphql() function then send the output back to the browser correctly. For most of my implementations I’ve also handled authentication and setup a context there too.

Once you’ve implemented that you’re just writing the schema/resolvers.

There are other options depending your preferred language including

@buggy Do you have a sample code by any chance? I’m new to both Lambda and
GraphQL so having confusions. Working on NodeJS though.

I’ve done this for Madison Square Garden: https://github.com/HoraceShmorace/msg-graphql-api.

This was just a proof of concept for what ended up being a real application, so ignore the fact that the data layer simply relays to a public REST API. A production application should access a database directly.

2 Likes