issue #64 completed for editor route

This commit is contained in:
Henrique Dias committed 2016-03-12 09:25:15 +00:00
1 parent 3fd60e487a
commit 3301b60485
7 files changed
+52 -63

No files matched your search

+9 -3
View File
@@ -8,16 +8,22 @@ import (
"github.com/hacdias/caddy-hugo/config"
)
var (
filename string
conf *config.Config
)
// ServeHTTP serves the editor page
func ServeHTTP(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error) {
filename := strings.Replace(r.URL.Path, "/admin/edit/", "", 1)
conf = c
filename = strings.Replace(r.URL.Path, "/admin/edit/", "", 1)
filename = c.Path + filename
switch r.Method {
case "POST":
return POST(w, r, c, filename)
return POST(w, r)
case "GET":
return GET(w, r, c, filename)
return GET(w, r)
default:
return http.StatusMethodNotAllowed, errors.New("Invalid method.")
}