-
Notifications
You must be signed in to change notification settings - Fork 1
Add your own REST url
Michael Jolin edited this page Jul 7, 2017
·
5 revisions
myproject
+-- mypackage
| +-- app
| | +-- resturls
| | | +-- firsturl.py
| | | +-- secondurl.py
| +-- api_url.py
Example of api_url.py file
from cause.api.management.core.database import Database
from cause.api.management.resturls.base import Base
class FirstUrl(Base):
table_name = 'ssi'
mapping_method = {
'GET': 'get',
'PUT': '',
'POST': '',
'DELETE': '',
'PATCH': '',
}
def get(self):
""" Return all fire safety department
"""
with Database() as db:
return {
'data': db.execute("SELECT * FROM mytable;")
}