Is there somewhere an example with resources and J...
# ktor
a
What problem do you encounter? You can just combine resources and serialization.
l
When I combine them I have a 404 Not Found for my route. That is why I wanted an example.
a
Could you please share your code?
l
I can share my project on github
a
Ok
l
a
You need to rewrite your classes to that child resources have a reference to parent resources:
Copy code
@Serializable
@Resource("/bears/{name}")
class BearsResource(val name: String) {

    @Serializable
    @Resource("{id}")
    class Id(val parent: BearsResource, val id: String) {

        @Serializable
        @Resource("hibernate")
        class Hibernate(val parent: BearsResource.Id, val id: String)
    }
}
l
Thanks for the help @Aleksei Tirman [JB] Is there a way to get the url from the the Id class, something like
Copy code
Id(BearsResource(),"123").toURL() -> "/bears/123"
I would need it to add the Location header when I create a bear
a
Copy code
application.href(BearsResource.Id(BearsResource("name"),"123"))
l
Thanks again. You have to get used to it, but I’m starting to like the new plugin.