remove concept of prod and dev assets

instead always do the "prod" thing, but use entr for restarting the
server for all assets
This commit is contained in:
sentriz
2019-07-08 13:36:26 +01:00
parent b44b0d8720
commit ba2f835c22
11 changed files with 59 additions and 106 deletions

View File

@@ -1,7 +1,6 @@
package server
import (
"errors"
"net/http"
"time"
@@ -10,8 +9,7 @@ import (
)
type Server struct {
mux *http.ServeMux
assets *Assets
mux *http.ServeMux
*handler.Controller
*http.Server
}
@@ -20,7 +18,6 @@ func New(
db *db.DB,
musicPath string,
listenAddr string,
assetPath string,
) *Server {
mux := http.NewServeMux()
server := &http.Server{
@@ -34,23 +31,13 @@ func New(
DB: db,
MusicPath: musicPath,
}
assets := &Assets{
BasePath: assetPath,
}
return &Server{
mux: mux,
assets: assets,
Server: server,
Controller: controller,
}
}
var ErrAssetNotFound = errors.New("asset not found")
type Assets struct {
BasePath string
}
type middleware func(next http.HandlerFunc) http.HandlerFunc
func newChain(wares ...middleware) middleware {