Posts

Showing posts from 2021

Getting started with understanding what are API's, the types of API's and how to get started with creating a REST API with FastAPI

Image
  Objectives By the end of this tutorial, you will be able to: Explain why you may want to use GraphQL over REST Use Orator ORM to interact with a Postgres database Describe what Schemas, Mutations, and Queries are in GraphQL Integrate GraphQL into a FastAPI app with Graphene Test a GraphQL API with Graphene and pytest Why GraphQL? (And why GraphQL over traditional REST?) REST  is the de-facto standard for building web APIs. With REST, you have multiple endpoints for each CRUD operation: GET, POST, PUT, DELETE. Data is gathered by accessing a number of endpoints. For example, if you wanted to get a particular user's profile info along with their posts and relevant comments, you would need to call four different endpoints: /users/<id>  returns the initial user data /users/<id>/posts  returns all posts for a given user /users/<post_id>/comments  returns a list of comments per post /users/<id>/comments  returns a list of comments per user This can result in req