Closed pythononwheels closed 5 years ago
Done.
You can use method routes from PythonOnWheels: 0.9x. The current version 0.912 fully supports this.
@app.make_routes()
decorator@route
decorator.In contrast to the class based routes you can obviously omit the dispatch parameter which defines the method to call for this route. Since you attach the route to the method directly.
Both methods to define routes work equivalently and can be chosen by your choice. Choose whatver you prefer to be more handy..
Example:
@app.make_routes()
class HelloHandler(BaseHandler):
@route('/hello', dispatch=["get"])
def hello(self):
self.write("Hello world!")
More info can be found in the routing documentation
Use the class decorator add_route style for methods as well. Of course the method name can be left out then. See:
add_mroute(...)
below... shold be called add_route as well in the real implementation.sample: