summaryrefslogtreecommitdiffhomepage
path: root/http
diff options
context:
space:
mode:
authorChloe Kudryavtsev <toast@toast.cafe>2019-11-24 13:33:14 -0500
committerChloe Kudryavtsev <toast@toast.cafe>2019-11-24 13:33:14 -0500
commit680e1e476c0be4eb375c3c5789bda66a7a648b10 (patch)
treea3a6c42b7ff7fac9810c5d18c44a008cbc07b922 /http
parentDocument new storage selection option (diff)
Documentation pass
- document Get - document Index - document Put - unexport global settings from main
Diffstat (limited to 'http')
-rw-r--r--http/get.go1
-rw-r--r--http/index.go1
-rw-r--r--http/put.go1
3 files changed, 3 insertions, 0 deletions
diff --git a/http/get.go b/http/get.go
index 016173f..903b5b2 100644
--- a/http/get.go
+++ b/http/get.go
@@ -6,6 +6,7 @@ import (
"toast.cafe/x/brpaste/v2/template"
)
+// Get generates a handler for the /:key[/:lang] endpoint
func Get(store storage.CHR) handler {
return func(ctx *fasthttp.RequestCtx) {
ukey := ctx.UserValue("key")
diff --git a/http/index.go b/http/index.go
index 124e172..792e64a 100644
--- a/http/index.go
+++ b/http/index.go
@@ -5,6 +5,7 @@ import (
"toast.cafe/x/brpaste/v2/template"
)
+// Index handles the / endpoint
func Index(ctx *fasthttp.RequestCtx) {
ctx.SuccessString("text/html", template.Index()) // render template
}
diff --git a/http/put.go b/http/put.go
index bc49e74..6f581bf 100644
--- a/http/put.go
+++ b/http/put.go
@@ -9,6 +9,7 @@ import (
"toast.cafe/x/brpaste/v2/storage"
)
+// Put generates a handler for the POST / and PUT /:key endpoints
func Put(store storage.CHR, put bool) handler {
return func(ctx *fasthttp.RequestCtx) {
data := ctx.FormValue("data")