Merge pull request #259 from yoloseem/route

Correct Router documentation
This commit is contained in:
Eli Uriegas 2017-01-03 18:47:54 -06:00 committed by GitHub
commit 16959caa34

View File

@ -31,12 +31,12 @@ class Router:
""" """
Router supports basic routing with parameters and method checks Router supports basic routing with parameters and method checks
Usage: Usage:
@sanic.route('/my/url/<my_parameter>', methods=['GET', 'POST', ...]) @app.route('/my_url/<my_param>', methods=['GET', 'POST', ...])
def my_route(request, my_parameter): def my_route(request, my_param):
do stuff... do stuff...
or or
@sanic.route('/my/url/<my_paramter>:type', methods['GET', 'POST', ...]) @app.route('/my_url/<my_param:my_type>', methods=['GET', 'POST', ...])
def my_route_with_type(request, my_parameter): def my_route_with_type(request, my_param: my_type):
do stuff... do stuff...
Parameters will be passed as keyword arguments to the request handling Parameters will be passed as keyword arguments to the request handling