Documentation
¶
Overview ¶
Package api provides an API server for controlling the Dice core.
Package api provides an API server for controlling the Dice core.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the actual HTTP server exposing a REST API. It will accept requests on the specified TCP address and handles these requests using the provided controller.Controller instance. The listening port has to be secured against remote access.
func NewServer ¶
func NewServer(config ServerConfig, controller *controller.Controller) *Server
NewServer creates a new Server instance and initializes all routes.
func (*Server) Run ¶
Run makes the API server listen on the specified TCP address and accept incoming requests. This function should be called in an extra goroutine since Run is a blocking function.
Unlike ListenAndServe from net/http, Run only returns real errors, meaning that it won't return an error when shutting down.
type ServerConfig ¶
ServerConfig concludes properties that are configurable by the user.