server

package
v2.1.2-beta1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BlogRootFlagName = "root-path"

BlogRootFlagName is the CLI flag name for setting a blog root path.

View Source
const HostFlagName = "host"

HostFlagName is the CLI flag name for setting the HTTP bind address.

View Source
const InputPostsDirArgName = "input-posts"

InputPostsDirArgName is the CLI argument name for the input posts directory.

View Source
const PortFlagName = "port"

PortFlagName is the CLI flag name for setting the HTTP listen port.

View Source
const TemplateDirFlagName = "template-dir"

TemplateDirFlagName is the CLI flag name for setting a template directory.

Variables

View Source
var ServeCommand cli.Command = cli.Command{
	Name:                   "serve",
	Aliases:                []string{"s"},
	Usage:                  "serve a blog from markdown posts over HTTP",
	Action:                 NewServeCommand,
	UseShortOptionHandling: true,
	Arguments: []cli.Argument{
		&cli.StringArg{
			Name:      InputPostsDirArgName,
			UsageText: "<input directory>",
		},
	},
	Flags: []cli.Flag{
		&cli.IntFlag{
			Name:    PortFlagName,
			Aliases: []string{"P"},
			Usage:   "port to listen on",
			Value:   8080,
		},
		&cli.StringFlag{
			Name:    HostFlagName,
			Aliases: []string{"H"},
			Usage:   "host address to bind to",
		},
		&cli.StringFlag{
			Name:    TemplateDirFlagName,
			Aliases: []string{"t"},
			Usage:   "directory of templates to use when rendering",
		},
		&cli.StringFlag{
			Name:    BlogRootFlagName,
			Aliases: []string{"p"},
			Usage:   "root path of the blog, defaults to '/'",
		},
	},
}

ServeCommand is the main entry point for the GoBlog serve CLI tool. This command sets up all the flags, usage info, and action for serve.

Functions

func NewServeCommand added in v2.1.0

func NewServeCommand(ctx context.Context, c *cli.Command) error

NewServeCommand handles the serve command by starting an HTTP server from a directory of markdown posts.

Types

This section is empty.

Jump to

Keyboard shortcuts

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