summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--main.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/main.go b/main.go
index 25d95af..bca7847 100644
--- a/main.go
+++ b/main.go
@@ -14,6 +14,9 @@ const getwtxt = "0.1"
 
 func main() {
 
+	// StrictSlash(true) allows /api and /api/
+	// to serve the same content without duplicating
+	// handlers/paths
 	index := mux.NewRouter().StrictSlash(true)
 	api := index.PathPrefix("/api").Subrouter()
 
@@ -24,9 +27,6 @@ func main() {
 	index.Path("/api").
 		Methods("GET").
 		HandlerFunc(apiBaseHandler)
-	api.Path("/").
-		Methods("GET").
-		HandlerFunc(apiBaseHandler)
 	// twtxt will add support for other formats later.
 	// Maybe json? Making this future-proof.
 	api.Path("/{format:(?:plain)}").
@@ -48,9 +48,11 @@ func main() {
 		Queries("url", "{url}", "nickname", "{nickname:[a-zA-Z0-9]+}").
 		Methods("POST").
 		HandlerFunc(apiEndpointPOSTHandler)
+	// Show all observed tags
 	api.Path("/{format:(?:plain)}/tags").
 		Methods("GET").
 		HandlerFunc(apiTagsBaseHandler)
+	// Requests tweets with a specific tag
 	api.Path("/{format:(?:plain)}/tags/{tags:[a-zA-Z0-9]+}").
 		Methods("GET").
 		HandlerFunc(apiTagsHandler)