Files
accounting/internal/api/api.go

24 lines
423 B
Go

package api
import (
"fmt"
"log/slog"
"net/http"
"time"
)
func Start(log *slog.Logger, address string) error {
mux := http.NewServeMux()
RegisterRoutes(log, mux)
s := &http.Server{
Addr: address,
Handler: mux,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
log.Info(fmt.Sprintf("Start API on %s", address))
return s.ListenAndServe()
}