Welcome to
The newline Guide to Building Your First GraphQL Server with Node and TypeScript
Course Syllabus and Content
Introduction
2 Lessons 5 Minutes
Introduction to the Newline guide to building your first GraphQL server with Node and TypeScript.
Quick walkthrough of the development environment and tools used in the course.
Getting Started With Our Node Server
12 Lessons1 Hours 21 Minutes
This is an introduction to the work we'll be doing in Module 1.0.
Node is a JavaScript runtime environment that can run on different platforms (Mac, Windows, Linux, etc.). It was first introduced in 2009 by Ryan Dahl, as a response to how slow web servers were at the time. In this lesson, we'll introduce Node and talk about the capability Node provides to make I/O tasks asynchronous and non-blocking.
In this lesson, we'll use Node to run a simple JavaScript file on the server.
Web servers provide functionality for requests that can be made from client applications. Node has a built-in HTTP module that provides the capability to create a server. 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.
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.
JavaScript is considered a weakly typed language. In this lesson, we'll go through a simple example of why that can be an issue in development and where TypeScript falls in the picture.
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.
TypeScript is a development tool geared towards making building JavaScript applications more robust. In an application's deployed state (browser or server), TypeScript must be compiled to valid JavaScript. In this lesson, we'll see how the TypeScript compiler provides us with a command to compile and produce JavaScript code from TypeScript.
Though VSCode includes TypeScript language support which helps us pick up TypeScript errors in our TypeScript code, we'll introduce more robust code checking with ESLint - a popular open-source JavaScript/TypeScript linting tool.
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.
In this lesson, we'll use the routing capabilities Express gives us to create GET and POST routes that interact with the mock data listings array we've established.
This lesson is a summary of the work we've done in Module 1.0 where we built a very simple Node/Express/Typescript project.
Comparing REST & GraphQL APIs
4 Lessons 27 Minutes
In this module, we'll explain what GraphQL is, compare Github's REST and GraphQL APIs, and dive deeper into some core concepts of 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.
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). We'll dive into a good example that showcases GraphQL before we discuss and address some of GraphQL's core concepts.
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
6 Lessons 37 Minutes
In this module, we'll install Apollo Server and the GraphQL JavaScript library, create a GraphQL Schema, build GraphQL resolver functions to interact with our mock data, and recreate our schema with the much simpler GraphQL Schema Language.
In this lesson, we'll install the Express variation of the popular Apollo Server library and the GraphQL JavaScript library.
In this lesson, we'll use the Apollo Server and GraphQL JavaScript libraries to create a minimal GraphQL API that we'll be able to interact with in an IDE environment known as GraphQL Playground.
In this lesson, we'll look to mimic the listings retrieval and manipulation we had in our Express RESTful API but with GraphQL instead.
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.
This lesson is a summary of the final state of the work done in Module 3.0.
Conclusion
1 Lesson 2 Minutes
Enroll in TinyHouse to continue the course!