|
Mm |
at Apr 20, 2015 at 7:38 pm
|
⇧ |
| |
Ok found what I am looking for...Using Gocraft:
You can capture path variables like this:
router.Get("/suggestions/:suggestion_id/comments/:comment_id")
In your handler, you can access them like this:
func (c *YourContext) Root(rw web.ResponseWriter, req *web.Request) {
fmt.Fprint(rw, "Suggestion ID:", req.PathParams["suggestion_id"])
fmt.Fprint(rw, "Comment ID:", req.PathParams["comment_id"])
}
You can also validate the format of your path params with a regexp. For
instance, to ensure the 'ids' start with a digit:
router.Get("/suggestions/:suggestion_id:\\d.*/comments/:comment_id:\\d.*")
On Monday, April 20, 2015 at 12:22:29 PM UTC-4, mm wrote:Could someone point me to a nice implementation of how CRUD is used in GO?
So far I have found this -
http://paste.ubuntu.com/8503695/but it is incomplete. I come from Python, so I really need an example of
how CRUD is used in GO.
thanks
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.