celrenheit/lion

Multiple resource types

celrenheit opened this issue · 0 comments

Currently there is only one form of resources (RESTful).
This is a small proposal to extend resource to multiple type.

RESTful

router.Resource("/users", myResource)
HTTP method Path Struct's method name
GET /users Get
Head /users Head
POST /users Post
PUT /users Put
PATCH /users Patch
DELETE /users Delete
CONNECT /users Connect

Resourceful

router.Resource("/users", myResource)
HTTP method Path Struct's method name
GET /users Index
POST /users Create
GET /users/:id Show
PUT or PATCH /users/:id Update
DELETE /users/:id Destroy

Hopefully this could be customized.
I currently have not decided the best way to specify differents types.
The resource could implement an interface or by embedding a type.

Feedback are welcome