refactor asset with embed tool

This commit is contained in:
sentriz
2019-06-26 12:01:49 +01:00
parent e6c6d2406f
commit d8881bd31c
35 changed files with 11004 additions and 21662 deletions

View File

@@ -24,12 +24,18 @@ func newChain(wares ...middleware) middleware {
}
type Server struct {
mux *http.ServeMux
mux *http.ServeMux
assets *Assets
*handler.Controller
*http.Server
}
func New(db *gorm.DB, musicPath string, listenAddr string) *Server {
func New(
db *gorm.DB,
musicPath string,
listenAddr string,
assetPath string,
) *Server {
mux := http.NewServeMux()
server := &http.Server{
Addr: listenAddr,
@@ -42,8 +48,12 @@ func New(db *gorm.DB, musicPath string, listenAddr string) *Server {
DB: db,
MusicPath: musicPath,
}
assets := &Assets{
BasePath: assetPath,
}
return &Server{
mux: mux,
assets: assets,
Server: server,
Controller: controller,
}