-
Notifications
You must be signed in to change notification settings - Fork 1
Create complex routing
Michael Jolin edited this page Aug 18, 2017
·
5 revisions
To use the complex routing method, you need to pass the ApiUrl class as second argument of ConfigApi inside server.py file.
site_config = ConfigApi({
'response.timeout': 3000
}, ApiUrl)
Inside your api_url.py file, you need to replace all method with the decorator "@cherrypy.expose" with a new instance of "RouteUrl" object for every URL.
RouteUrl('/buildingpersonrequiringassistance/', 'BuildingPersonRequiringAssistance')
RouteUrl('/buildingpersonrequiringassistance/:id_building', 'BuildingPersonRequiringAssistance', 'GET', 'get')
RouteUrl('/buildingpersonrequiringassistance/:id_building_person_requiring_assistance', 'BuildingPersonRequiringAssistance', 'DELETE', 'remove')
RouteUrl parameters are:
- URL path
- Class to instantiate for URL is call
- [HTML method on calling]
If no HTML method are pass, the API use the class property "mapping_method" to find which method need to be call.
It's possible to use "ALL" as HTML method - [Class method to call]