summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-11 04:40:29 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-11 04:40:29 -0400
commitbd2800a976bb61a5d1e67c084597116f5edc5a08 (patch)
tree02855b7980fb3c9d26bfb700cc2e400ee797d1b1
parentc87acad59c4436554e60ab14870b77e49046c84a (diff)
downloadgetwtxt-bd2800a976bb61a5d1e67c084597116f5edc5a08.tar.gz
query vars to endpoint in routing
-rw-r--r--main.go4
1 files changed, 3 insertions, 1 deletions
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)