server

package
v0.0.0-...-09dfd77 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

package server contains the implementation for an http server that watches for changes in the provided directory.

Index

Constants

This section is empty.

Variables

View Source
var ServerCommand = &cli.Command{
	Name:      "server",
	Aliases:   []string{"start", "serve"},
	Usage:     "starts the server",
	UsageText: "starts the development server at the provided port",
	Description: strings.Join(
		[]string{
			"instantiates a filesystem watcher and serves ",
			"a website with pages for each markdown file.",
		},
		"\n",
	),
	ArgsUsage: "[config]",
	Flags: config.MergeFlags(
		&cli.IntFlag{
			Name:     "port",
			Aliases:  []string{"p", "addr"},
			Required: false,
		}, true),
	Action: Run,
}
View Source
var (
	ServerLogger *log.Logger
)

Functions

func Run

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

function Run is an ActionFunc for the cli library. It creates a filesystem watcher for the provided directory and a server that handles requests to the provided address. When a change is detected in the filesystem, the server is locked and gracefully shutsdown.

Types

This section is empty.

Jump to

Keyboard shortcuts

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