Documentation
¶
Overview ¶
Package embedded provides functionality for running tinkerdown apps from embedded filesystems. This is primarily used by standalone binaries built with `tinkerdown build`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Serve ¶
Serve starts a server that serves content from an embedded filesystem. This is the primary entry point for standalone binaries built with `tinkerdown build`.
Parameters:
- contentFS: An embed.FS containing the markdown files and optional config
- rootPath: The path prefix within the embed.FS (e.g., "content")
- addr: The address to listen on (e.g., "localhost:8080")
Example usage:
//go:embed content/*
var contentFS embed.FS
func main() {
embedded.Serve(contentFS, "content", "localhost:8080")
}
func ServeWithOptions ¶
ServeWithOptions starts a server with more configuration options.
Types ¶
type Options ¶
type Options struct {
// ContentFS is the embedded filesystem containing markdown files
ContentFS fs.FS
// RootPath is the path prefix within the ContentFS (e.g., "content")
RootPath string
// Addr is the address to listen on (e.g., "localhost:8080")
Addr string
// Config overrides the embedded config (optional)
Config *config.Config
// OnReady is called when the server is ready to accept connections (optional)
OnReady func()
// Quiet suppresses startup messages when true
Quiet bool
}
Options provides configuration for the embedded server.
Click to show internal directories.
Click to hide internal directories.