1
0
Fork 0

Dashboard server draft

This commit is contained in:
Gregory Eremin 2015-10-27 04:22:45 +03:00
parent 80da11ad60
commit 7af5b18d85
1 changed files with 27 additions and 0 deletions

27
server/server.go Normal file
View File

@ -0,0 +1,27 @@
package server
import (
"fmt"
"net/http"
)
type Server struct {
port int
mux *http.ServeMux
}
func NewServer(port int) *Server {
return &Server{
port: port,
mux: http.NewServeMux(),
}
}
func (s *Server) Handle(pattern string, handler http.Handler) {
s.mux.Handle(pattern, handler)
}
func (s *Server) Start() {
addr := fmt.Sprintf(":%d", port)
go http.ListenAndServe(addr, s.mux)
}