@@ 11,6 11,7 @@ import (
"sync"
"time"
+ "git.sr.ht/~gloatingfiddle/coffeebeans/internal/handlers"
"git.sr.ht/~gloatingfiddle/coffeebeans/internal/version"
)
@@ 30,13 31,9 @@ func Run(ctx context.Context, baseCancel context.CancelFunc, args []string, stdo
logger.InfoContext(ctx, "starting", slog.Group("environment", slog.Int("port", e.port)))
- mux := http.NewServeMux()
- mux.Handle("/{$}", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte("Hello world!"))
- }))
s := http.Server{
Addr: fmt.Sprintf("127.0.0.1:%d", e.port),
- Handler: mux,
+ Handler: handlers.SetupRoutes(),
}
go func() {
if err := s.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {