Template repository for a Service using FastAPI + Strawberry-Graphql + MongoDB.
Contains example code for various variations of queries, mutations, types and models, for further reference and easy coding...
Check out Sample
entities, for reference.
- Click the green
Use this template
button on the top right to create a new repository in the personal account for the service. - Clone the newly created repository to make changes and push.
- Copy .env file (Make changes in it as required):
cp .example.env .env
- Build and spin up all services:
docker compose up --build -d
- Check out
localhost:80
- To stop, press
Ctrl + C
# Create document
curl -X 'POST' \
'http://localhost:8000/graphql' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"query": "mutation{sampleMutationOne(sampleInput: {attribute2: \"hi\", email: \"[email protected]\", name: \"test\"}) {name}}"}'
# Get documents
curl -X 'POST' \
'http://localhost:8000/graphql' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"query": "query{sampleQueryTwo{attribute1, name}}"}'
This code was referred from the template code (Private Repository in Clubs-Council-IIITH Organisation) by [@bhavberi]https://(github.com/bhavberi), @ek234 and @v15hv4.