How to build GraphQL server with Node.js and express.js

David Mráz
Atheros
5 min readJul 28, 2017

--

GraphQL is taking over the API world. If you have recently been introduced to this query language and want to try out its features in Javascript, you should follow this quick tutorial for setting up your GraphQL server in Node JS using Express. Assuming you already have Node JS installed on your computer, you can check your version with this command

node -v

The output to the console should be something like this

v6.10.0

This tutorial is, of course, not limited to this particular version. Due to rapid changes in the Node JS environment, it’s better to use the LTS version.

Checkout the upcoming free GraphQL language course with in browser exercices

From upcoming GraphQL Language course

What libraries should we use?

First of all, we need to install the graphql-js library, which implements the GraphQL specification for Node JS and Express in our project. As for the integration of these two libraries, we basically have two options. We can use either express-graphql or graphql-server from the Apollo team. There are only minor differences between the two…

--

--

David Mráz
Atheros

Founder of https://atheros.ai | Artificial Intelligence | Machine Learning | JavaScript, Python, C++ | Business