Reputation: 51
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.
Upvotes: 2
Views: 3097
Reputation: 18
I hope it helps
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'GET':
pass
elif request.method == 'POST':
pass
else:
pass
Upvotes: -2
Reputation: 26050
Look at quick start (A Minimal API, Resourceful Routing and etc.):
api.add_resource(HelloWorld, '/')
api.add_resource(TodoSimple, '/<string:todo_id>')
Upvotes: 4