Posts

Showing posts from December, 2020

App with fastapi, Arangodb and Graphql

Image
Configuring fastapi, arangodb and graphql with authentication: It uses fastapi graphene, graphene-pydantic, python-arango and fastapi-jwt-auth mkdir fastapi_learn_project cd fastapi_learn_project virtualenv -p python3 env source env/bin/activate pip3 install fastapi uvicorn graphene graphene-pydantic==0.1.0 python-arango fastapi-jwt-auth Setup database database.py 1 2 3 4 5 6 7 from arango import ArangoClient # Initialize the ArangoDB client. client = ArangoClient(hosts= 'http://localhost:8529' ) # Connect to "test" database as root user. db = client.db( 'fastapidemo' , username= 'root' , password= '****' ) You can find how to set up arangodb at: serializers.py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 from typing import List, Optional from graphene_pydantic import PydanticInputObjectType, PydanticObjectType from pydantic import BaseModel class UserModel (BaseModel): _id: str name