|
|
|
|
|
by topicseed
1304 days ago
|
|
I create a simple func for each handler to parse params. Most urls params are properly structured as /resources/{resourceID}/subresources/{subresourceID}. So I can essentially create a map[string]string by splitting slashes and going 0 = key, 1 = value, 2 = key, 3 = value, etc. If a handler uses a different structure like /resources/{resourceID}/{subresourceD}, I will have the func specifically handle that case. Some ways may work better but this works for me and it's not magical, and I tend to touch that code once and never again so it's then out of the way, all in a file. |
|