Documentation
¶
Index ¶
- type Config
- type ServerHandler
- func (h *ServerHandler) CreateTemplateServer(progress chan<- string) error
- func (h *ServerHandler) MainInputFileRelativePath() string
- func (h *ServerHandler) NewFileEvent(fileName, extension, filePath, event string) error
- func (h *ServerHandler) RestartServer() error
- func (h *ServerHandler) StartServer(wg *sync.WaitGroup)
- func (h *ServerHandler) SupportedExtensions() []string
- func (h *ServerHandler) UnobservedFiles() []string
- type ServerStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
AppRootDir string // e.g., /home/user/project (application root directory)
SourceDir string // directory location of main.go e.g., src/cmd/appserver (relative to AppRootDir)
OutputDir string // compilation and execution directory e.g., deploy/appserver (relative to AppRootDir)
PublicDir string // default public dir for generated server (e.g., src/web/public)
MainInputFile string // main input file name (default: "main.go", can be "server.go", etc.)
ArgumentsForCompilingServer func() []string // e.g., []string{"-X 'main.version=v1.0.0'"}
ArgumentsToRunServer func() []string // e.g., []string{"dev"}
AppPort string // e.g., 8080
Routes []func(*http.ServeMux) // Functions to register routes on the HTTP server
Logger func(message ...any) // For logging output
ExitChan chan bool // Global channel to signal shutdown
}
type ServerHandler ¶
type ServerHandler struct {
*Config
// contains filtered or unexported fields
}
func New ¶
func New(c *Config) *ServerHandler
func (*ServerHandler) CreateTemplateServer ¶ added in v0.1.16
func (h *ServerHandler) CreateTemplateServer(progress chan<- string) error
CreateTemplateServer switches from In-Memory to External mode. It generates the server files (if not present), compiles, and runs them. This implements the transition from "In-Memory" to "Permanent" (External) mode.
func (*ServerHandler) MainInputFileRelativePath ¶
func (h *ServerHandler) MainInputFileRelativePath() string
MainInputFileRelativePath returns the path relative to AppRootDir (e.g., "src/cmd/appserver/main.go")
func (*ServerHandler) NewFileEvent ¶
func (h *ServerHandler) NewFileEvent(fileName, extension, filePath, event string) error
event: create,write,remove,rename
func (*ServerHandler) RestartServer ¶
func (h *ServerHandler) RestartServer() error
func (*ServerHandler) StartServer ¶
func (h *ServerHandler) StartServer(wg *sync.WaitGroup)
Start initiates the server using the current strategy (In-Memory or External)
func (*ServerHandler) SupportedExtensions ¶
func (h *ServerHandler) SupportedExtensions() []string
func (*ServerHandler) UnobservedFiles ¶
func (h *ServerHandler) UnobservedFiles() []string
UnobservedFiles returns the list of files that should not be tracked by file watchers
Click to show internal directories.
Click to hide internal directories.