whee
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user