-
-
Notifications
You must be signed in to change notification settings - Fork 390
Description
Thanks for putting together and maintaining this project. This is more of a question than an issue, so please let me know if this is not the right place to ask.
I'm using hug in an API with resources organized as classes, (similar to how described in this issue ##213). I'd like to separate the routes to their own files. I noticed that the README and code examples accomplish this with @hug.extend_api(). I'm fumbling with it and haven't gotten it to work. I assume it's because the examples are written for functions and not classes and wonder if there's something obvious that I'm missing.
Do you have an example of doing this with classes?
GET /example, GET /example/id, POST /example, etc. live in one file. I'd like to move each to its own file/class.
Some sample code to give some color to how the routes are organized.
get = hug.object.get(output=..., on_invalid=..., requires=...)
class ExampleResource(ResourceAbstract):
@get.urls('/example', versions=1)
def get_example(self, request, response):
return {...}
@get.urls('/example/{id}', versions=1)
def get_by_id(self, request, response, id):
return {...}
...