- Newest
- Most votes
- Most comments
Yes you can use both APIs by amplify add api
command. You have to answer the questions asked about API configurations while creating API. Then proceed with the command again and add another API (either API gateway - REST or Appsync - GraphQL one)
It is possible to have a mix of APIs (GraphQL and REST, for example) in a project and even to share data stores (such as databases) between the various API schema. Nevertheless, you should be aware of some of the complexities that you have to face with such a decision and compare it to the option to convert the clients of the REST APIs to use GraphQL.
GraphQL is prevalent in mobile development as you want to be efficient in the number of calls that you need to do to the backend to fetch data, in the screen size of presenting that data, and the power (CPU, battery life...) of the mobile device to execute it. You might claim that these issues are not relevant to other data system interfaces such as desktops and prefer to use a more traditional API such as REST to build the interface.
When developing with a GraphQL attitude, you define the objects you want to work with using the format of GraphQL schema. In contrast, in the REST attitude, you will use Database Schema or API defined in code using frameworks such as FastAPI or Spring. GraphQL is more flexible, and you can create "graph" objects with columns or attributes from different related entities, while in REST, you will have to perform this logic on the client-side after calling multiple API calls to fetch the data.
There is also a tendency to associate GraphQL with a NoSQL database such as DynamoDB or MongoDB, and REST APIs more with Relational databases, where you can define relations between the objects in the "graph" in the relational model of the DB. This is also a type of a mix that you want to avoid, as data replication between these different datastore types is hard to maintain.
Eventually, you want to query and update the same object in the same datastore, and have different schema or datastore will make it complicated to evolve and modify them in parallel.
Yes, you can definitely use both AWS AppSync (GraphQL) and AWS API Gateway (REST API) in the same project. AWS provides various services that allow you to build different types of APIs based on your project's requirements.
Relevant content
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago