Install the package by:
bin/gip install -e 'git+https://github.com/fragaria/gap-resources#egg=gap_resources'
Add routes to src/routes.py:
routes = ( ... include('/_my_resources_base_url', 'resources.routes') ... )
Register your models in src/routes.py:
from myapp.models import MyModel from resources import register register(MyModel)
Register models for whole package
Open src/config.py in your project and add RESOURCES_AUTODISCOVER with list of modules where resources should look for models.
Example::
RESOURCES_AUTODISCOVER = [ 'app.myapp.models', ]
Start your app and list your project on
GET .
- list of models
GET <model-slug>/
- model objects list
GET <model-slug>/describe
- full description
POST <model-slug>/<id>
- updates existing object (and returns its data)
POST <model-slug>/
- creates new object (and returns it)
see resources/views.py for details