Plug & Play GraphQL (pnp-graphql)-- Change Log
A library for making GraphQL API with Python/Django. This is like a flash drive, just how you plug into computer and transfer files.
Read Full Documentation here: https://docs.ashraful.dev/pnp-graphql
Documentation is coming soon...
- Install from pip
pip install pnp-graphql - Add
graphene_djangoon top of installed apps on settings.py - Add
pnp_graphqlinto installed apps on settings.py - Add PnP GraphQL config on settings.
GRAPHENE = {
'SCHEMA': 'pnp_graphql.schema.schema'
}
PNP_GRAPHQL = {
'ENABLED_APPS': ['example_app'],
# If you want to use Token Authentication. Otherwise it's optional
'AUTHENTICATION_CLASS': 'pnp_graphql.authentication.TokenAuthentication'
}- Add the following code on
urls.py
from pnp_graphql.urls import urlpatterns as up
urlpatterns = [
# ... ... ...
]
urlpatterns += up- Set
DEBUG = Falsefor production use.
That's it :)
Now visit: http://your-ip:port/api/graphql-explorer/ for explore GraphQL built-in UI explorer for query.
Production ready API : http://your-ip:port/api/graphql/
- GraphQL query
- Mutation (Create, Update, Delete)
- Pagination
- API filtering for Number, String, Date, DateTime
- Authentication
- Proper error handling
- Field validation
- Caching
- many more ... ... ...