router

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package router provides an http.Handler implementation with a nice API for registering routes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router is a wrapper around an http.ServeMux that provides a slightly nicer API for registering routes.

func New

func New() Router

New creates a new Router.

func (Router) GET

func (router Router) GET(path string, h http.HandlerFunc)

GET registers a route at the provided path that responds to GET requests.

func (Router) POST

func (router Router) POST(path string, h http.HandlerFunc)

POST registers a route at the provided path that responds to POST requests.

func (Router) ServeFiles

func (router Router) ServeFiles(prefix, dir string)

ServeFiles serves static files located in `dir` and accessed via requests whose path starts with `prefix`.

func (Router) ServeHTTP

func (router Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface.

Jump to

Keyboard shortcuts

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