dougblack / sleepy

rest for go
673 stars 56 forks source link

Add URL Variable Rules #9

Open dougblack opened 10 years ago

dougblack commented 10 years ago

In many RESTful APIs, there is data stored in the URI. sleepy should be able to parse it out.

For example

/users/1

can be expressed as

/users/:id

and then id could be passed to the matching resource method as a url.Values key-value pair.

L1fescape commented 10 years ago

Hey @dougblack, I started working on a fix for this issue here. It works as you proposed where

/users/1

expressed as

/users/:id

will add a key id with a value of 1 to url.Values.

For the most part it's working, but there are somethings I could do better. If anyone has any suggestions, let me know! In the mean time I'll be fixing bugs with it and polishing up the code, then submitting a pull request.