filebrowser/editor/editor.go

23 lines
424 B
Go
Raw Normal View History

2015-09-18 15:49:53 +00:00
package editor
import (
"net/http"
"strings"
2015-09-27 19:01:44 +00:00
"github.com/hacdias/caddy-cms/config"
2015-09-18 15:49:53 +00:00
)
2015-09-20 08:15:21 +00:00
// ServeHTTP serves the editor page
func ServeHTTP(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error) {
2015-09-18 15:49:53 +00:00
filename := strings.Replace(r.URL.Path, "/admin/edit/", "", 1)
2015-09-26 21:02:49 +00:00
switch r.Method {
case "POST":
return POST(w, r, c, filename)
case "GET":
return GET(w, r, c, filename)
2015-09-19 13:25:35 +00:00
default:
return 400, nil
}
2015-09-19 13:47:59 +00:00
}