Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func InitServer ¶ added in v0.3.0
func (Server) Start ¶ added in v0.4.0
Start initializes the server, sets up routes and middlewares, and starts listening for incoming requests.
This method:
- Initializes analytics.
- Configures the echo server with recovery, logging, and CORS middleware.
- Sets up various routes, including serving static files for the dashboard and a swagger UI.
- Starts the echo server and manages its lifecycle with background goroutines.
- Gracefully shuts down the server on context cancellation.
- Closes database connections and other resources.
Parameters:
- ctx: A context.Context used to control the server's lifecycle and propagate cancellation.
Returns:
- A slice of channels (service.Done) that signal when different parts of the service have completed their work. This includes: 1. The main echo server's completion. 2. The host's completion. 3. Completion of analytics event flushing.
- A channel (service.Fail) that reports errors that occur while the server is running.
- An error if there is an issue during the initialization phase, otherwise nil.
Click to show internal directories.
Click to hide internal directories.