This commit is contained in:
Bel LaPointe
2022-02-08 10:27:33 -07:00
parent f09d8e6cc9
commit 8f8dd81404
6 changed files with 97 additions and 4 deletions

View File

@@ -9,11 +9,13 @@ import (
type Server struct {
router *router.Router
root string
}
func NewServer() *Server {
func NewServer(root string) *Server {
return &Server{
router: router.New(),
root: root,
}
}
@@ -26,6 +28,7 @@ func (server *Server) Routes() error {
}
_ = wildcards
for path, handler := range map[string]func(http.ResponseWriter, *http.Request) error{
"/": server.rootHandler,
"/api/v0/tree": server.apiV0TreeHandler,
"/api/v0/media": server.apiV0MediaHandler,
wildcard("/api/v0/media"): server.apiV0MediaIDHandler,
@@ -75,3 +78,7 @@ func (server *Server) apiV0FilesIDHandler(w http.ResponseWriter, r *http.Request
func (server *Server) apiV0SearchHandler(w http.ResponseWriter, r *http.Request) error {
return errors.New("not impl" + r.URL.Path)
}
func (server *Server) rootHandler(w http.ResponseWriter, r *http.Request) error {
return errors.New("not impl" + r.URL.Path)
}