{"modulePath":"github.com/data-preservation-programs/singularity","version":"v1.0.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\n## Functions\n\n```go\nfunc Run(c *cli.Context) error\n```\n\n## Types\n\n```go\ntype APIParams struct {\n\tListener   net.Listener\n\tLotusAPI   string\n\tLotusToken string\n\tConnString string\n}\n```\n\n```go\ntype HTTPError struct {\n\tErr string `json:\"err\"`\n}\n```\n\n```go\ntype Server struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc InitServer(ctx context.Context, params APIParams) (*Server, error)\n```\n\n```go\nfunc (s *Server) Name() string\n```\n\n```go\nfunc (s *Server) Start(ctx context.Context, exitErr chan\u003c- error) error\n```\nStart initializes the server, sets up routes and middlewares, and starts listening for incoming requests.\n\nThis method:\n\n  - Initializes analytics.\n  - Configures the echo server with recovery, logging, and CORS middleware.\n  - Sets up various routes, including serving static files for the dashboard and a swagger UI.\n  - Starts the echo server and manages its lifecycle with background goroutines.\n  - Gracefully shuts down the server on context cancellation.\n  - Closes database connections and other resources.\n\nParameters:\n\n  - ctx: A context.Context used to control the server's lifecycle and propagate cancellation.\n  - exitErr: A channel that receives the terminal error (or nil) once the server has shut down.\n\nReturns:\n\n  - An error if there is an issue during the initialization phase, otherwise nil.\n\n","path":"github.com/data-preservation-programs/singularity/api","name":"api","synopsis":"","isRedistributable":true}
