routes

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package routes provides types and functions used to collect routes and associated metadata. The route metadata is used to generate an index listing available routes supported by the application and the collected routes are registered with the servemux for request handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route

type Route struct {
	Name           string
	Pattern        string
	Description    string
	HandlerFunc    http.HandlerFunc
	AllowedMethods []string
}

Route reflects the patterns and handlers for each supported path in our API.

type Routes

type Routes []Route

Routes is a collection of defined routes, intended for bulk registration and auto-indexing on the landing page for this application

func (*Routes) Add

func (rs *Routes) Add(r ...Route)

Add appends one or many new routes to the existing Routes collection.

func (Routes) ListNames

func (rs Routes) ListNames() []string

ListNames provides a list of all recorded route names in Routes

func (Routes) ListURIs

func (rs Routes) ListURIs() []string

ListURIs provides a list of all recorded route patterns in Routes

func (*Routes) RegisterWithServeMux

func (rs *Routes) RegisterWithServeMux(mux *http.ServeMux)

RegisterWithServeMux registers each recorded Route with the specified HTTP ServeMux.

Jump to

Keyboard shortcuts

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