package api import ( "net/http" "git.leonardobishop.net/history/api/handlers" "git.leonardobishop.net/history/api/middleware" "git.leonardobishop.net/history/internal/config" "git.leonardobishop.net/history/pkg/entries" "git.leonardobishop.net/history/pkg/html" ) type ApiServices struct { EntiresService entries.Service HtmlService html.Service Config config.Config } func NewServer(api ApiServices) *http.ServeMux { mux := http.NewServeMux() mux.HandleFunc("POST /record", middleware.Cors(handlers.RecordEntry(api.EntiresService, api.Config.Token))) mux.HandleFunc("GET /html", handlers.GetEntriesHtml(api.EntiresService, api.HtmlService)) return mux }