guregodevo/pastis

Resource should be composite

Closed this issue · 1 comments

A resource can be added to another resource and behave as any resource.
For example :
Resource Person can be added to resource URI company.

(personResource) Get(...) {
}

(personResource) Post(...) {
}

...
resource := CompanyResource
personResource := PersonResource

resource.embed("/:companyname/employee",personResource)
api.AddResource("/company", resource)
api.Start(54666)

View employees of the company named "Huston" should be view at URI /company/
curl http://locahost:54666/huston/employee

There is no need to add extra services to make resource composite. Adding a nested resource to a parent resource URI is easy enough.