DEV CHAT: Create a Serverless GraphQL server using Express, Apollo Server and AWS Lambda

SovTech
SovTech
Sep 4, 2018 · 2 min read

…because who wouldn’t want a Serverless GraphQL server, right !?

If you’ve mucked around with GraphQL, Serverless and love JavaScript — you’ve come to the right place. What’s better than mixing a few of the most exciting technologies in recent times, not much, eh.

Continuing in our Serverless journey, and further building on a previous post, where we’ve explored Rendering and serving a Create-React-App from an Express server running within a Lambda functionlet’s now turn our focus towards GraphQL and marry it with Serverless. And, in doing so, eliminate the need to have a continuously running GraphQL instance, an ops dream.

We will be using AWS Lambda functions along with the Serverless Framework for our server. Our Lambdas will run the Node.JS 8.1 runtime. We will also make use of Webpack for all it’s bundling goodness and Babel to transpile our pile.

In order to get our Serverless GraphQL server up and running we will need to:

  • Setup a Serverless
  • Create an Express App
  • Pull in and configure Apollo Server

Running our GraphQL server for the first time!

You’ll notice that our two endpoints will be created, /graphql being our GraphQL server endpoint and our playground at /playground .To test our server, let’s navigate to our playground, http://localhost:3000/playground

Execute a simple query, and behold the magic of a Serverless GraphQL server…😎

Our Serverless GraphQL server in all it’s glory 😎

Apollo serverAWS LambdaexpressgraphqlServerlessSovTech Dev Chatwebpack


Originally published at sov.tech by one of SovTech’s Fullstack Developers, Yatin Badal.

SovTech Insights

We design, build, deploy and maintain innovative custom software that gives our clients the opportunity to start, run and grow world class businesses.

SovTech

Written by

SovTech

Business Software. Sorted™. https://sov.tech/

SovTech Insights

We design, build, deploy and maintain innovative custom software that gives our clients the opportunity to start, run and grow world class businesses.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade