Documentation
¶
Index ¶
- Constants
- type Celeritas
- func (c *Celeritas) CreateDirIfNotExist(path string) error
- func (c *Celeritas) CreateFileIfNotExists(path string) error
- func (c *Celeritas) Init(p initPaths) error
- func (c *Celeritas) ListenAndServe()
- func (c *Celeritas) New(rootPath string) error
- func (c *Celeritas) StartLoggers() (*log.Logger, *log.Logger)
Constants ¶
const (
Version = "1.0.0"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Celeritas ¶ added in v1.3.0
type Celeritas struct {
AppName string
Debug bool
Version string
ErrorLog *log.Logger
InfoLog *log.Logger
RootPath string
Routes *chi.Mux
// contains filtered or unexported fields
}
Celeritas is the main application struct
func (*Celeritas) CreateDirIfNotExist ¶ added in v1.3.0
CreateDirIfNotExist takes a path string and returns an error. It creates the directory if it does not exist.
func (*Celeritas) CreateFileIfNotExists ¶ added in v1.3.0
CreateFileIfNotExists creates a new empty file at the specified path if one doesn't exist. If the file already exists, it does nothing and returns nil. The created file is automatically closed after creation. It returns an error if the file creation fails.
func (*Celeritas) ListenAndServe ¶ added in v1.3.0
func (c *Celeritas) ListenAndServe()
ListenAndServe starts and runs the HTTP server until it encounters an error. It configures the server with:
- Idle timeout of 30 seconds
- Read timeout of 30 seconds
- Write timeout of 600 seconds
The server listens on the port specified in the application config. If the server encounters an error during startup or operation, it logs the error and terminates the application.
func (*Celeritas) StartLoggers ¶ added in v1.3.0
StartLoggers initializes the application's logging system with two loggers: an InfoLog for general information (in green) and an ErrorLog for error messages (in red). Both loggers write to standard output with different prefixes, formats, and colors. It returns two loggers for info and error logging respectively.