summaryrefslogtreecommitdiff
path: root/pkg/rpc/server.go
blob: a71ed8ca91c48143d2a5d26289cdb9f761861254 (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 rpc

import (
	fmt "fmt"
	http "net/http"
)

func New() http.Handler {
	mux := http.NewServeMux()
	for _, handler := range handlers() {
		fmt.Printf("Registering : %v\n", handler.PathPrefix())
		mux.Handle(handler.PathPrefix(), handler)
	}

	mux.Handle("/health", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(http.StatusOK)
	}))
	return mux
}

func handlers() []TwirpServer {
	return []TwirpServer{
		NewAbilityServer(NewAbilityService()),
	}
}