router

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package router provides API endpoint routing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(groups ...Group) *gin.Engine

New creates a router engine with all the provided endpoint groups mounted.

Types

type Group

type Group interface {

	// Prefixes returns the common path prefixes for endpoints in the group.
	// A common use of prefixes is for versioning RESTful APIs, and since a
	// group can have multiple path prefixes, the group of the default version
	// can use both the root path and the specific version path.
	Prefixes() []string

	// Mount initializes group-level middlewares and mounts the endpoints.
	Mount(*gin.RouterGroup)
}

Group defines the interface for mountable API endpoint groups. Endpoints in a group share the same path prefix and have common middlewares.

Jump to

Keyboard shortcuts

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