Skip to content

vladcalin/django-gemstone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-gemstone

JSONRPC microservices with Django

Quick example usage:

  • include "django_gemstone" in INSTALLED_APPS
  • create methods.py in any installed app
  • in methods.py write the exposed methods
from django_gemstone.decorators import exposed_method

@exposed_method()
def say_hello(name):
    return "Hello {}".format(name)
  
  • in urls, include the following
from django_gemstone import views
# ...
urlpatterns = [
  # ...
  url(r'^api', views.JsonRpcEndpoint.as_view())
]
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "say_hello",
  "params": {
    "name": "world"
  }
}

The response should be

{
  "id": 1,
  "jsonrpc": "2.0",
  "error": null,
  "result": "hello world"
}

Testing

python examples/test_projects/manage.py test django_gemstone

About

JSONRPC microservices with Django

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages