go_ssr

package module
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 20 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.1.12

type Config struct {
	AppEnv              string // "production" or "development"
	AssetRoute          string // The route to serve assets from, e.g. "/assets"
	FrontendDir         string // The path to the frontend folder, where your React app lives
	GeneratedTypesPath  string // The path to the generated types file
	PropsStructsPath    string // The path to the Go structs file, the structs will be generated to TS types
	LayoutFilePath      string // The path to the layout file, relative to the frontend dir
	LayoutCSSFilePath   string // The path to the layout css file, relative to the frontend dir
	TailwindConfigPath  string // The path to the tailwind config file
	HotReloadServerPort int    // The port to run the hot reload server on, 3001 by default
}

Config is the config for starting the engine

func (*Config) Validate added in v0.1.12

func (c *Config) Validate() error

Validate validates the config

type Engine added in v0.1.12

type Engine struct {
	Logger                  zerolog.Logger
	Config                  *Config
	HotReload               *HotReload
	CacheManager            *cache.Manager
	CachedLayoutCSSFilePath string
}

func New added in v0.1.12

func New(config Config) (*Engine, error)

New creates a new gossr Engine instance

func (*Engine) BuildLayoutCSSFile added in v0.1.12

func (engine *Engine) BuildLayoutCSSFile() error

BuildLayoutCSSFile builds the layout css file if it exists

func (*Engine) RenderRoute added in v0.1.12

func (engine *Engine) RenderRoute(renderConfig RenderConfig) []byte

RenderRoute renders a route to html

type HotReload added in v0.1.12

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

func (*HotReload) Start added in v0.1.12

func (hr *HotReload) Start()

Start starts the hot reload server and watcher

type RenderConfig added in v0.1.12

type RenderConfig struct {
	File     string
	Title    string
	MetaTags map[string]string
	Props    interface{}
}

RenderConfig is the config for rendering a route

Directories

Path Synopsis
cli module
gossr-cli module
internal

Jump to

Keyboard shortcuts

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