Skip to content

vizeit/GraphQLServer-Ariadne-AzureFunc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL Server - Ariadne - Azure Function

Boilerplate Serverless implementation of GraphQL server in Python using Ariadne

Features

  • Schema-first approach
  • Implemented in Python
  • Serverless
  • Hosting on Azure Cloud
  • Modular
  • Support for WSGI and ASGI
  • Lightweight
  • Test-driven Development

Quickstart

Prerequisites

Steps

  1. Clone the repo,
git clone https://github.com/vizeit/GraphQLServer-Ariadne-AzureFunc.git
  1. Install ariadne
pip install ariadne
  1. Go to __init__.py

  2. Import GraphQL class from either WSGI or ASGI module of Ariadne

from ariadne.wsgi import GraphQL

or

from ariadne.asgi import GraphQL
  1. Import WsgiMiddleware or AsgiMiddleware class from azure.functions module
from azure.functions import WsgiMiddleware

or

from azure.functions import AsgiMiddleware
  1. Return WsgiMiddleware or AsgiMiddleware object from the main function w.r.t. your import in 3 and 4 above
return WsgiMiddleware(app).handle(req, context)

or

return AsgiMiddleware(app).handle(req, context)
  1. Define GraphQL schema under Schemas folder

  2. Write GraphQL resolvers for the schema in resolvers.py

  3. Add the unit tests under tests folder. Run the unit tests after any changes,

python -m unittest -v tests/*.py

Releases

No releases published

Packages

No packages published

Languages