embedded

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 13 Imported by: 0

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

func Serve(contentFS fs.FS, rootPath string, addr string) error

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

func ServeWithOptions(opts Options) error

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.

Jump to

Keyboard shortcuts

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