Django-based REST API Framework
Project description
# Rinzler REST Framework
Django-based REST Framework
# Requires
```PHP
pip install rinzler
```
# Usage
```Python
# urls.py
from your_controller import Controller
from rinzler.core.url_assembler import UrlAssembler
assembler = UrlAssembler()
urlpatterns = [
assembler.mount('', Controller)
]
# your_controller.py
from django.http.request import HttpRequest
from django.views.generic import TemplateView
from rinzler.core.response import Response
class Controller(TemplateView):
def connect(self, app):
router = app['router']
router.get('/', self.hello_world)
return app
# end-point callbacks here:
@staticmethod
def hello_world(request: HttpRequest, app: dict(), **params: dict):
"""
Default route callback
:param request HttpRequest
:param app Rinzler's object
:param params dict url params, if present
:rtype: Response
"""
response = {
"status": True,
"data": "Hello World!"
}
return Response(response, content_type="application/json")
```
Django-based REST Framework
# Requires
```PHP
pip install rinzler
```
# Usage
```Python
# urls.py
from your_controller import Controller
from rinzler.core.url_assembler import UrlAssembler
assembler = UrlAssembler()
urlpatterns = [
assembler.mount('', Controller)
]
# your_controller.py
from django.http.request import HttpRequest
from django.views.generic import TemplateView
from rinzler.core.response import Response
class Controller(TemplateView):
def connect(self, app):
router = app['router']
router.get('/', self.hello_world)
return app
# end-point callbacks here:
@staticmethod
def hello_world(request: HttpRequest, app: dict(), **params: dict):
"""
Default route callback
:param request HttpRequest
:param app Rinzler's object
:param params dict url params, if present
:rtype: Response
"""
response = {
"status": True,
"data": "Hello World!"
}
return Response(response, content_type="application/json")
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for rinzler-1.15.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 167af3ebc966dd5d58a04672f15eb4f3add9b75d75522aeb3020d20b818c4dbd |
|
MD5 | 1aa6599e0b6af30d7ffa66d2936a5213 |
|
BLAKE2b-256 | 6dc59c8da1eabb58e82ba217cd94f3102f36754200bc8dcb7b4ca912097d4701 |