this repo has no description
at main 413 B view raw
1package internal 2 3import "net/http" 4 5func NewServer(port string) error { 6 pubsub := NewPubSub() 7 8 r := &http.ServeMux{} 9 r.HandleFunc("GET /subscribe", middlewareRequestId(middlewareTopicQueryParam(pubsub.HandleSubscribe))) 10 r.HandleFunc("POST /publish", middlewareRequestId(middlewareTopicQueryParam(pubsub.HandlePublish))) 11 12 server := http.Server{Addr: ":" + port, Handler: r} 13 return server.ListenAndServe() 14}