summary refs log tree commit diff stats
path: root/handlers.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-12 23:36:04 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-12 23:36:04 -0400
commitd2680fb62bac6c779f371b2b6839592274a8d281 (patch)
treeae6adcc3609396a44eed63462e292c57066f1dcb /handlers.go
parent1f8b2ce166e104bca99e4a758bb658dd27d5e4d6 (diff)
downloadgetwtxt-d2680fb62bac6c779f371b2b6839592274a8d281.tar.gz
reorganized handlers. StrictSlash(true). handling POST /api/plain/users for new users
Diffstat (limited to 'handlers.go')
-rw-r--r--handlers.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/handlers.go b/handlers.go
index 3998228..a44c9d8 100644
--- a/handlers.go
+++ b/handlers.go
@@ -64,6 +64,20 @@ func apiEndpointHandler(w http.ResponseWriter, r *http.Request) {
 
 }
 
+// handles POST for "/api/plain/users"
+func apiEndpointPOSTHandler(w http.ResponseWriter, r *http.Request) {
+	vars := mux.Vars(r)
+	format := vars["format"]
+	endpoint := vars["endpoint"]
+
+	w.Header().Set("Content-Type", htmlutf8)
+	n, err := w.Write([]byte(format + "/" + endpoint))
+	if err != nil || n == 0 {
+		log.Printf("Error writing to HTTP stream: %v\n", err)
+	}
+
+}
+
 // handles "/api/plain/tags"
 func apiTagsBaseHandler(w http.ResponseWriter, r *http.Request) {
 	vars := mux.Vars(r)