Building a GraphQL API for a Forum with TypeScript

Using TypeScript and ApolloServer to build a GraphQL API

In this episode, we are going to build a GraphQL backend using apollo-server that interacts with our business logic layer.

We’ll start the server by using apollo-server. Apollo server implements a spec-compliant GraphQL server, which of course means that it can be queried by any GraphQL client, not just Apollo client.

We will add the necessary libraries. As dependencies for our back-end, we will need graphql and apollo-server.

yarn add graphql yarn add @types/graphql yarn add apollo-server yarn add graphql-type-datetime

This will give us the starting point for our back-end using TypeScript. We are also using a library for the graphql datetime type that we are going to use. Let's start by getting the simplest possible GraphQL server working.

If we use the code from the Getting Started section in the Apollo Server GraphQL docs, we have list of books and the Book type. Let's run the server, and then we can see that we can already fetch some data from our back-end server. We will...

Previous

Building a Forum Elixir GraphQL Backend with Absinthe

login to comment
  1. Hi, I don't see postgresQL mentioned anywhere in the text of the tutorial is this the database being used (I see it mentioned in the code)? Where is the video with the postgres setup?

  2. Comments for Building a GraphQL API for a Forum with TypeScript