Route DSL
Project description
Python eDSL for your Web Routes
pip install routedsl
Compose everything in one place
routes = Routes() (
GET / 'users' / ('user_id', User, "User identifier")
| HEADERS | Headers
| RETURNS | JSON [ User ]
| HANDLER | get_user_info
| GUARDS | ( Headers.content_type | IS | 'application/json'
)
| DOCS | """Get a user profile in JSON format"""
)(
POST / 'users' / ('user_id', User)
| HEADERS | Headers
| PAYLOAD | JSON [ User ]
| RETURNS | OK [ JSON [ bool ] ]
| HANDLER | update_user_info
)
or define pieces separately, then assemble your routing map:
DefaultHeaders = HEADERS | Headers
DefaultHandler = HANDLER | default_handler
DefaultEndpoint = GET / DefaultHeaders
| DefaultHandler
routes = Routes() | DefaultEndpoint
Use nesting under common prefix
routes = (routes / 'users' / ('user_id', User)) (
POST / 'edit'
| HEADERS | Headers
| RETURNS | JSON [ User ]
| HANDLER | update_user_info
)
Read more in Official Documentation.
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 Distribution
routedsl-0.0.1.tar.gz
(5.2 kB
view hashes)