notfound

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package notfound provides a terminal handler that responds with 404 Not Found. Register it last, after all routes and other middleware, to produce a consistent "not found" response for unmatched requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Options) express.Handler

New returns a terminal handler that always responds 404. It does not call next.

Types

type Options

type Options struct {
	// Message is the body sent with the 404 response. When empty a default
	// message is used.
	Message string

	// JSON, when true, sends the message as a JSON object {"error": message}
	// instead of plain text.
	JSON bool
}

Options configures the notfound handler.

Jump to

Keyboard shortcuts

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