GraphQL Node JS | MySQL | 13 Minute | Minimal | Apollo GraphQL

Onexlab
5 min readMay 21, 2022

In this article, we will show you how you can use GraphQL with Node JS and MySQL. We are using the Apollo GraphQL server in this tutorial.

GraphQL Node JS | MySQL | 13 Minute | Minimal | Apollo GraphQL

Video

Let’s start

Prerequisite: Make sure you have installed the following

  1. Docker Desktop: To learn more about making sure you have installed the Docker Desktop. You can read our following post about installation and usage

2. Node JS: Make sure you have installed Node JS to test the app without Docker.

Project Structure

Project
├── init (Directory)
|-- 01.sql (File)
├── docker-compose.yml (File)
├── connection.js(File)
├── index.js(File)
├── package.json(File)

Step 1: Create New Project

  1. From your preferred development directory, create a directory for a new project and cd into it:
mkdir nodejs-graphql
cd nodejs-graphql

2. Initialize a new Node.js project with npm (or another package manager you prefer, such as Yarn):

npm init --yes

Step 2: Add Dependencies

Applications that run Apollo Server require two top-level dependencies:

--

--