Skip to content

acarreno-houseloan/python-graphql-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL example

This repository holds a Graphql example using Graphene and Mongoengine.

Requirements

  • Docker
  • Docker compose

How to run

docker compose up

This will start the server on http://localhost:8000/. By default the database is empty, but you can add some fake data by running the following command:

docker compose exec graphene python -m database.seed --users 10 --posts 10 --comments 10

This will create 10 users, 10 posts generated by any random user in the database, and 10 comments on any random post in the database. You can of course change the number of each entity.

How to query

You can use the GraphiQL interface to query the server. You can access it by going to http://localhost:8000/. A simple query would be:

{
  users {
    id
    name
    email
  }
}

Or you can filter the users by username:

{
  users(username: "John") {
    id
    name
    email
  }
}

Filtering can be done on any field defined as argument in each property of my_graphql.query.Query.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages