This commit is contained in:
parent
28a4f4121e
commit
98191fd098
7 changed files with 112 additions and 11 deletions
|
@ -26,8 +26,33 @@
|
|||
// TODO: Decide how long the Linstrom-RPC API will remain backwards compatible
|
||||
package webpublic
|
||||
|
||||
import "net/http"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
server http.Server
|
||||
server *http.Server
|
||||
}
|
||||
|
||||
func New(addr string) *Server {
|
||||
handler := http.NewServeMux()
|
||||
handler.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(500)
|
||||
fmt.Fprint(w, "not implemented")
|
||||
})
|
||||
server := http.Server{
|
||||
Handler: handler,
|
||||
Addr: addr,
|
||||
}
|
||||
return &Server{&server}
|
||||
}
|
||||
|
||||
func (s *Server) Start() error {
|
||||
return s.server.ListenAndServe()
|
||||
}
|
||||
|
||||
func (s *Server) Stop() error {
|
||||
return s.server.Shutdown(context.Background())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue