How to Add Apollo Server for a GraphQL API in a Node.js App
In this lesson, we'll install the Express variation of the popular Apollo Server library and the GraphQL JavaScript library.
Installing Apollo Server and GraphQL#
📣 The
graphql
JavaScript library now provides its own type definitions so we'll no longer need to install the accompanying community prepared typings.
In the lesson video, we show how we install the additional typings for the
graphql
library from the DefinitelyTyped repository. As of now, however, we'll no longer need to install the community provided typings since thegraphql
library now provides its own type definitions!
We've mentioned that the GraphQL specification isn't tied to any specific technology. We've also talked about one of the popular suite of tools in the GraphQL ecosystem, Apollo.
Apollo Server is one of the libraries within the Apollo framework and its responsibility is to help build a GraphQL API within Node applications. Apollo Server enables us to connect a GraphQL schema to a server and can be used to spin up a stand-alone server, be an add-on to an existing Node server, or even work within "serverless" environments. We'll go with the approach of adding Apollo Server to our existing Node/Express server.
apollo-server-express#
This page is a preview of TinyHouse: A Fullstack React Masterclass with TypeScript and GraphQL