Flask Restful API网址 [英] Flask restful API urls
本文介绍了Flask Restful API网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Flask-RESTful( http://flask-restful.readthedocs .org/en/latest/index.html ).在阅读一些示例后,我了解到我的Resource类中只有get,post,update等方法.如何使用独特的URL来创建自己的Resource类方法,就像使用@ app.route()装饰器在Flask中那样?谢谢.
I am using Flask-RESTful(http://flask-restful.readthedocs.org/en/latest/index.html) in my project. Afrer reading some examples I understood that I will have only get, post, update etc methods in my Resource class. How can I make my own Resource class method with a unique url like it was in Flask with @app.route() decorator? Thanks.
推荐答案
快速入门(资源路由等):
api.add_resource(HelloWorld, '/')
api.add_resource(TodoSimple, '/<string:todo_id>')
这篇关于Flask Restful API网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文