aboutsummaryrefslogtreecommitdiff
path: root/internal/api/new.go
blob: d225b0250dfb6806f1d9238df61966109788966c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package api

import "net/http"

func New(config Config) *Server {
	mux := http.NewServeMux()

	server := &http.Server{
		Addr:    config.Address,
		Handler: mux,
	}

	srv := &Server{
		config: config,
		mux:    mux,
		http:   server,
	}

	srv.mux.HandleFunc(
		"GET /health",
		srv.handleHealth,
	)

	return srv
}