summary refs log tree commit diff stats
path: root/handlers.go
diff options
context:
space:
mode:
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"]
#n172'>172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237