aboutsummaryrefslogtreecommitdiff
path: root/edit.go
diff options
context:
space:
mode:
Diffstat (limited to 'edit.go')
-rw-r--r--edit.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/edit.go b/edit.go
new file mode 100644
index 0000000..a425a1a
--- /dev/null
+++ b/edit.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+ "net/http"
+ "text/template"
+)
+
+func init() {
+ http.HandleFunc("/edit/", editHandler)
+}
+
+func editHandler(w http.ResponseWriter, r *http.Request) {
+ title := r.URL.Path[len("/edit/"):]
+ p, _ := loadPage(title)
+ p.render(w, template.Must(template.ParseFiles("tmpl/root", "tmpl/edit")))
+}