26 lines
354 B
Go
26 lines
354 B
Go
package server
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"strconv"
|
|
)
|
|
|
|
type IServer interface {
|
|
ListenAndServe()
|
|
}
|
|
|
|
type Server struct {
|
|
Addr string
|
|
Server http.Server
|
|
Port int
|
|
}
|
|
|
|
func (s *Server) ListenAndServe() {
|
|
s.Addr = s.Addr + ":" + strconv.Itoa(s.Port)
|
|
serverError := s.Server.ListenAndServe()
|
|
if serverError != nil {
|
|
log.Fatal(serverError)
|
|
}
|
|
}
|