embedded

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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