Transitioning from REST to GraphQL
In a REST API, endpoints are typically defined as specific URLs that correspond to different resources. For example, to create a new user, we would make a POST
request to /users
. To retrieve a list of users, we might make a GET
request to the same endpoint. The server then performs the requested action or responds with the requested data.
In this chapter, we will learn how to use the existing REST API and provide a /graphql
endpoint for it. We will build a proxy backend that will communicate with the REST one using Node.js and TypeScript. We will also learn about the key differences between communication in GraphQL and REST as well as similarities.
After reading this chapter, you should be able to create a GraphQL API for an existing REST backend to make the work of frontend developers and other API consumers much more pleasant.
In this chapter, we will cover the following topics:
- Why transition to GraphQL?
- Transforming a REST...