server

package
v0.0.0-...-b9292d4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HomeHandler

func HomeHandler(c echo.Context) error

HomeHandler serves the home.html page.

Types

type Config

type Config struct {
	// Addr is the server's binding address.
	Addr string
	// Port is the server's binding port.
	Port int
	// DB is the server's database filename.
	DB string
}

Config is the server configuration.

type Server

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

Server implements a plant journal server.

func NewServer

func NewServer(ctx context.Context, logger *slog.Logger, config *Config) (*Server, error)

NewServer loads templates, establishes persistent data storage, sets the server and registers routes.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context)

Shutdown closes the server.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts serving the server.

type Template

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

Template implements the echo.Renderer interface, allowing the use of html templates.

func (*Template) Render

func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Render executes the template with given name and passed data.

Jump to

Keyboard shortcuts

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