Welcome, Getting Started

Introduction to the Newline guide to building your first GraphQL server with Node and TypeScript.

Project Source Code

Get the project source code below, and follow along with the lesson material.

Download Project Source Code

To set up the project on your local machine, please follow the directions provided in the README.md file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.

Welcome!

👩‍💻 Get access to the source code for this course - here.
🎳 Join us over at the #tinyhouse channel in our Discord organization - here.

Welcome to the The Newline guide to building your first GraphQL server with Node and TypeScript.

This course contains three core modules (i.e. chapters) that introduce and explain specific topics.

Module 1 - Getting Started With Our Node Server

In Module 1, we'll be creating a Node server from scratch with the help of the Express framework. We'll then introduce the benefits of TypeScript and integrate TypeScript into our Node server application.

For the details within this module:

  • We'll introduce Node and explain how Node is different to other web server technologies.
  • Run a simple JavaScript file with Node.
  • Create a server with the help of the popular Express package.
  • Use Nodemon as a development tool to help with automatic reloading of our code.
  • Introduce TypeScript and explain the benefits of using it.
  • Add TypeScript to our server project and see how we're able to compile a TypeScript project to valid JavaScript.
  • Install and use ESLint as our development code linting tool.
  • Finally, use mock data to create a GET and POST route within our server to mimic how RESTful APIs are to usually behave.

Module 2 - Comparing REST & GraphQL APIs

By the end of Module 1 - we would have created a RESTful API to interact with our mock data. A common question at this point would be, why would one need GraphQL?

GraphQL is a query language for APIs and was originally created to help client-side applications dictate the data they need before they request it. We thought the best way to introduce GraphQL would be to compare a real REST and GraphQL API that achieves the same outcome.

In this module, we'll:

Module 3 - Comparing REST & GraphQL APIs

By the end of Module 2, we will have an understanding of how GraphQL is a typed query language that allows client-side applications to request the data they want. With that said, how would one go about creating a GraphQL API?

GraphQL is a specification, not a direct implementation. This means GraphQL can be implemented in multiple programming languages. In our case, we'll be using Apollo to create our API.

In particular, we'll be using the Apollo Server package, which is the server package within the Apollo ecosystem. Apollo Server allows us to create a production-ready, self-documenting, GraphQL API in Node applications. It's really easy to get started with and incrementally adoptable.

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.
  • Finally, recreate our schema with the much simpler GraphQL Schema Language.

If you have any questions, don't hesitate to reach out to us in our Discord channel - #tinyhouse!

--

Hassan, Jing, and Nate

  • |

Lesson Transcript

  • [00:00 - 01:43] Hey everyone, welcome to the new line guide for building your first GraphQL server with no JS and TypeScripts. In this short video, we'll give a quick introduction as to what this course contains and the different lessons you'll go through. Now, this course is intended to web developers who are either new to some of the technologies we'll talk about or who are new to any of the technologies we actually cover. This course is around three modules or three chapters in length, which equates to about 23 lessons in total. And this is equivalent to about two and a half hours of visual content. In our very first module is when we get started with our server. We'll introduce node, explain how node is different to other web server technologies. We'll create a server with the help of the popular express package, introduce static typing with TypeScript and conclude the module by creating a get and post route within our server to mimic how restful APIs are to usually behave. In module two is when we compare the difference between restful APIs and GraphQL APIs. GraphQL is a query language for APIs that was originally created to help client side applications dictate the data they need before they request it. In module two, we'll explain what GraphQL is, compare a rest and GraphQL API of a production setting and we'll use GitHub's official production APIs to do so. And finally, we'll dive deeper into some of the core concepts of GraphQL. In module three, we'll move towards building our own GraphQL API.

  • [01:44 - 02:05] Now, one thing to always keep in mind is that GraphQL is a specification, not a direct implementation. And this means GraphQL can be implemented in many different programming languages. In our case, we're going to use the Apollo server package to create our GraphQL API from our node server.

  • [02:06 - 02:54] In module three, we'll install Apollo server and the GraphQL JavaScript library . We'll create a GraphQL schema, build GraphQL resolver functions to interact with our market data, and finally recreate our schema with the much simpler GraphQL schema language. Everything we've talked about just now will be reiterated as you go from module to module and lesson to lesson. At any moment in time, if you have a question, you'll find a link to the Discord channel at the top of this lesson documentation shared below. Feel free to hop onto the channel and ask us any questions you might come across and we'll be sure to respond and help you out. We hope you you enjoy the course and we'll see you in the next lesson.

  • [02:55 - 02:57] (upbeat music)