Phase 6
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
||||
|
||||
"github.com/uopi/uopi/internal/api"
|
||||
"github.com/uopi/uopi/internal/broker"
|
||||
"github.com/uopi/uopi/internal/datasource/synthetic"
|
||||
"github.com/uopi/uopi/internal/storage"
|
||||
)
|
||||
|
||||
const apiPrefix = "/api/v1"
|
||||
@@ -19,7 +21,8 @@ type Server struct {
|
||||
}
|
||||
|
||||
// New creates the HTTP server, registers all routes, and returns a ready-to-start Server.
|
||||
func New(addr string, webFS fs.FS, brk *broker.Broker, log *slog.Logger) *Server {
|
||||
// synth may be nil if the synthetic data source is not enabled.
|
||||
func New(addr string, webFS fs.FS, brk *broker.Broker, synth *synthetic.Synthetic, store *storage.Store, log *slog.Logger) *Server {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
// Health check
|
||||
@@ -32,7 +35,7 @@ func New(addr string, webFS fs.FS, brk *broker.Broker, log *slog.Logger) *Server
|
||||
mux.Handle("/ws", &wsHandler{broker: brk, log: log})
|
||||
|
||||
// REST API
|
||||
api.New(brk, log).Register(mux, apiPrefix)
|
||||
api.New(brk, synth, store, log).Register(mux, apiPrefix)
|
||||
|
||||
// Embedded frontend — must be last (catch-all)
|
||||
mux.Handle("/", http.FileServerFS(webFS))
|
||||
|
||||
Reference in New Issue
Block a user