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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user