api

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResponseWithError

func ResponseWithError(c *gin.Context, statusCode int, message string)

ResponseWithError sends a standardized error response

Types

type APIError

type APIError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

APIError represents a standardized error response

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents the API server

func NewServer

func NewServer(db *database.DB, config ServerConfig) *Server

NewServer creates a new API server

func (*Server) Start

func (s *Server) Start() error

Start starts the API server with graceful shutdown

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully stops the API server

type ServerConfig

type ServerConfig struct {
	Port       string
	UIPath     string
	Debug      bool
	AllowCORS  bool
	CORSOrigin string
}

ServerConfig contains configuration options for the server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL