From bd2800a976bb61a5d1e67c084597116f5edc5a08 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Sat, 11 May 2019 04:40:29 -0400 Subject: query vars to endpoint in routing --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 9cc1337..453426a 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,9 @@ func main() { index.HandleFunc("/", indexHandler) api.HandleFunc("/", apiBaseHandler) api.HandleFunc("/{format:(?:plain)}", apiFormatHandler) - api.HandleFunc("/{format:(?:plain)}/{endpoint:(?:mentions|users|tweets)}", apiEndpointHandler) + api.Path("/{format:(?:plain)}/{endpoint:(?:mentions|users|tweets)}"). + Queries("url", "{url}", "q", "{query}", "nickname", "{nickname}"). + HandlerFunc(apiEndpointHandler) api.HandleFunc("/{format:(?:plain)}/tags", apiTagsBaseHandler) api.HandleFunc("/{format:(?:plain)}/tags/{tags:[a-zA-Z0-9]+}", apiTagsHandler) -- cgit 1.4.1-2-gfad0