If suppose we want to implement the following end points in single class resource, Is there any way to put multiple on_get methods within single resource that would differentiate each end point ? Because it makes sense to put under single class as they are pretty much closely related.
Possible end points :
/api/{id}
/api/v1/{id}
/api/{id}/appended
/api/v1/appended/{id}
Update on Falcon 2.0:
Now Falcon 2.0 support "suffix" out of the box in add_route. For more info refer this. You can use the following code:
For Falcon older than V2.0:
I hope the following code will help you if you have the same logic for all said route:
This code route to the same on_get method. But I still suggest that you write a separate class with the different on_get method. And if most of the code is similar than you can write helper function and call it whenever needed.
Also, As you mention that "you want to put multiple on_get methods within a single resource that would differentiate each endpoint" which is not possible, but there is a workaround.
You can use the same on_get method and based on the route you can use different logic for each.