diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-05-22 02:50:34 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-05-22 03:21:29 -0400 |
commit | 37bf8b04e76ea1cce678238af48ac8097348e655 (patch) | |
tree | 5b3e2e38435fc3f51f2ee55a5684d4a31ce4b56b /main.go | |
parent | 29c35a301b66f0bc7fe2fb102ac2548ca9b522c9 (diff) | |
download | getwtxt-37bf8b04e76ea1cce678238af48ac8097348e655.tar.gz |
tuning query handling
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/main.go b/main.go index 61acb42..43c204b 100644 --- a/main.go +++ b/main.go @@ -51,12 +51,27 @@ func main() { Methods("GET"). HandlerFunc(apiEndpointHandler) - // This is for submitting new users + // This is for submitting new users. Both query variables must exist + // in the request for this to match. api.Path("/{format:(?:plain)}/{endpoint:users}"). Queries("url", "{url}", "nickname", "{nickname:[a-zA-Z0-9_-]+}"). Methods("POST"). HandlerFunc(apiEndpointPOSTHandler) + // This is for submitting new users incorrectly + // and letting the requester know about their error. + api.Path("/{format:(?:plain)}/{endpoint:users}"). + Queries("url", "{url}"). + Methods("POST"). + HandlerFunc(apiEndpointPOSTHandler) + + // This is for submitting new users incorrectly + // and letting the requester know about their error. + api.Path("/{format:(?:plain)}/{endpoint:users}"). + Queries("nickname", "{nickname:[a-zA-Z0-9_-]+}"). + Methods("POST"). + HandlerFunc(apiEndpointPOSTHandler) + // Show all observed tags api.Path("/{format:(?:plain)}/tags"). Methods("GET"). |