The newline Guide to Building Your First GraphQL Server with Node and TypeScript
Example Code DownloadYou can download the complete example code by clicking here.
Getting Started With Our Node Server
Module 1 Introduction
This is an introduction to the work we'll be doing in Module 1.0.
What is Node?
Creating a minimal Node:Express Server
Web servers provide functionality for requests that can be made from client applications. Node has a built-in HTTP module to allow for building a server that facilitates the transfer of data in HTTP. With this lesson, we'll look to use the popular Express framework as the replacement of the core HTTP module to create a minimal Node server, with Express routing.
Automatic Reloading Using Nodemon
Nodemon is an open-source utility tool that helps automatically restart a Node server whenever a change in code is detected in development. In this lesson, we'll install Nodemon and introduce an application script that will start the Node server with Nodemon.
Adding TypeScript to our Server
We'll get started with TypeScript in this lesson by installing a few necessary packages in our server and setting up the configuration of our TypeScript compiler.
Compiling our TypeScript project
Linting with ESLint
Introducing mock listings
To help us get started, we'll begin by introducing a mock data array of rental listings in this lesson. This will help us get started before we begin to address more appropriate data persistence.
Creating GET and POST Express routes
In this lesson, we'll use the routing capabilities Express gives us to create GET and POST routes that interact with the mock data array we've established.
Module 1 Summary
This lesson is a summary of the work we've done in Module 1.0.
Comparing REST & GraphQL APIs
Module 2 Introduction
Introduction to Module 2.0.
What is GraphQL?
GraphQL is a query language for APIs. In this lesson, we go through an initial discussion on GraphQL and how GraphQL differs from traditional REST APIs.
Comparing Github's REST and GraphQL APIs
Before we continue discussing some of the core concepts in GraphQL, we'll take a bit of a tangent in this lesson to contrast and compare Github's existing REST API (v3) and their GraphQL API (v4).
In this lesson, we introduce and discuss some of GraphQL's main concepts such as the GraphQL schema, object types and resolver functions.
Using Apollo Server To Create The GraphQL API
Module 3 Introduction
Introduction to Module 3.0.
Installing Apollo Server and GraphQL
Creating a GraphQL Schema with the GraphQL JS Library
Querying and mutating listings data with GraphQL
In this lesson, we'll look to mimic the listings retrieval and manipulation we had in our Express RESTful API but with GraphQL instead.
Using the GraphQL Schema Language
The GraphQL schema language is a human-readable syntax to help create GraphQL schemas. In this lesson, we'll use the GraphQL schema language to re-create the schema we have in a more readable and simpler format.
Module 3 Summary
This lesson is a summary of the final state of the work done in Module 3.0.