summary refs log tree commit diff stats
path: root/handlers.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-11 04:07:34 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-11 04:07:34 -0400
commitd3d9df2268345cb3bdcdcfa5712dfde0fdf7dbca (patch)
treea74b08563b2a34653b6ccc82b99fea5bb856707f /handlers.go
parenta0be15e3a8dd1b9062cb5f9d3a19dffc2a310745 (diff)
downloadgetwtxt-d3d9df2268345cb3bdcdcfa5712dfde0fdf7dbca.tar.gz
commenting early
Diffstat (limited to 'handlers.go')
-rw-r--r--handlers.go27
1 files changed, 19 insertions, 8 deletions
diff --git a/handlers.go b/handlers.go
index ac52559..3998228 100644
--- a/handlers.go
+++ b/handlers.go
@@ -10,6 +10,17 @@ import (
 	"github.com/gorilla/mux"
 )
 
+// handles "/"
+func indexHandler(w http.ResponseWriter, r *http.Request) {
+	w.Header().Set("Content-Type", htmlutf8)
+	n, err := w.Write([]byte(getwtxt))
+	if err != nil || n == 0 {
+		log.Printf("Error writing to HTTP stream: %v\n", err)
+	}
+
+}
+
+// handles "/api"
 func apiBaseHandler(w http.ResponseWriter, r *http.Request) {
 	timerfc3339, err := time.Now().MarshalText()
 	if err != nil {
@@ -26,14 +37,8 @@ func apiBaseHandler(w http.ResponseWriter, r *http.Request) {
 	}
 }
 
-func indexHandler(w http.ResponseWriter, r *http.Request) {
-	w.Header().Set("Content-Type", htmlutf8)
-	n, err := w.Write([]byte(getwtxt))
-	if err != nil || n == 0 {
-		log.Printf("Error writing to HTTP stream: %v\n", err)
-	}
-
-}
+// handles "/api/plain"
+// maybe add json/xml support later
 func apiFormatHandler(w http.ResponseWriter, r *http.Request) {
 	vars := mux.Vars(r)
 	format := vars["format"]
@@ -44,6 +49,8 @@ func apiFormatHandler(w http.ResponseWriter, r *http.Request) {
 		log.Printf("Error writing to HTTP stream: %v\n", err)
 	}
 }
+
+// handles "/api/plain/(users|mentions|tweets)"
 func apiEndpointHandler(w http.ResponseWriter, r *http.Request) {
 	vars := mux.Vars(r)
 	format := vars["format"]
@@ -56,6 +63,8 @@ func apiEndpointHandler(w http.ResponseWriter, r *http.Request) {
 	}
 
 }
+
+// handles "/api/plain/tags"
 func apiTagsBaseHandler(w http.ResponseWriter, r *http.Request) {
 	vars := mux.Vars(r)
 	format := vars["format"]
@@ -67,6 +76,8 @@ func apiTagsBaseHandler(w http.ResponseWriter, r *http.Request) {
 	}
 
 }
+
+// handles "/api/plain/tags/[a-zA-Z0-9]+"
 func apiTagsHandler(w http.ResponseWriter, r *http.Request) {
 	vars := mux.Vars(r)
 	format := vars["format"]