update file structure [ci skip]

This commit is contained in:
Henrique Dias
2016-03-06 19:18:46 +00:00
parent ddcaccda0c
commit 3f36200862
23 changed files with 180 additions and 165 deletions

24
routes/editor/editor.go Normal file
View File

@@ -0,0 +1,24 @@
package editor
import (
"errors"
"net/http"
"strings"
"github.com/hacdias/caddy-hugo/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)
filename = c.Path + filename
switch r.Method {
case "POST":
return POST(w, r, c, filename)
case "GET":
return GET(w, r, c, filename)
default:
return http.StatusMethodNotAllowed, errors.New("Invalid method.")
}
}