gomiddleware

package module
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 9 Imported by: 0

README

MrAndreID / Go Middleware

Go Reference

The MrAndreID/GoMiddleware package is a collection of functions in the go language.

Table of Contents

Installation

To use The MrAndreID/GoMiddleware package, you must follow the steps below:

go get -u github.com/MrAndreID/gomiddleware

Usage

To use The MrAndreID/GoMiddleware package, you must combine it with The gorilla/mux package or The Echo Framework.

Log for Gorilla Mux
import (
    "github.com/MrAndreID/gomiddleware"
)

router := mux.NewRouter().StrictSlash(true)

router.Handle("/api/v1/", gomiddleware.Log(Documentation)).Methods("GET")
Acceptable for Gorilla Mux
import (
    "github.com/MrAndreID/gomiddleware"
)

router := mux.NewRouter().StrictSlash(true)

router.Handle("/api/v1/", gomiddleware.Acceptable(Documentation)).Methods("POST")
Client ID for Gorilla Mux
import (
    "github.com/MrAndreID/gomiddleware"
)

router := mux.NewRouter().StrictSlash(true)

router.Handle("/api/v1/", gomiddleware.ClientID(Documentation)).Methods("POST")
Timestamp for Gorilla Mux
import (
    "github.com/MrAndreID/gomiddleware"
)

router := mux.NewRouter().StrictSlash(true)

router.Handle("/api/v1/", gomiddleware.Timestamp(Documentation)).Methods("POST")
App ID for Gorilla Mux
import (
    "github.com/MrAndreID/gomiddleware"
)

router := mux.NewRouter().StrictSlash(true)

router.Handle("/api/v1/", gomiddleware.AppID(Documentation)).Methods("POST")
Private Key for Gorilla Mux
import (
    "github.com/MrAndreID/gomiddleware"
)

router := mux.NewRouter().StrictSlash(true)

router.Handle("/api/v1/", gomiddleware.PrivateKey(Documentation)).Methods("POST")
Content Type for Gorilla Mux
import (
    "github.com/MrAndreID/gomiddleware"
)

router := mux.NewRouter().StrictSlash(true)

router.Handle("/api/v1/", gomiddleware.ContentType(Documentation)).Methods("POST")
Set Request ID for Echo Framework
import (
    "github.com/MrAndreID/gomiddleware"
)

e := echo.New()

e.Pre(gomiddleware.EchoSetRequestID)
Set No Cache for Echo Framework
import (
    "github.com/MrAndreID/gomiddleware"
)

e := echo.New()

e.Use(gomiddleware.EchoSetNoCache)
Set Route List for Echo Framework
import (
    "github.com/MrAndreID/gomiddleware"
)

e := echo.New()

e.Use(gomiddleware.EchoSetRouteList)
Set Maintenance Mode for Echo Framework
import (
    "github.com/MrAndreID/gomiddleware"
)

e := echo.New()

e.Use(gomiddleware.EchoSetMaintenanceMode("fileName.flag"))

Versioning

I use Semantic Versioning. For the versions available, see the tags on this repository.

Authors

Andrea Adam - MrAndreID

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

Official Documentation for Go Language

Documentation for Go Language can be found on the Go Package website.

License

The MrAndreID/GoMiddleware is released under the MIT License. See the LICENSE file for more information.

More

Documentation can be found on https://go.dev/.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Acceptable

func Acceptable(next http.HandlerFunc) http.HandlerFunc

func AppID

func AppID(next http.HandlerFunc) http.HandlerFunc

func ClientID

func ClientID(next http.HandlerFunc) http.HandlerFunc

func ContentType

func ContentType(next http.HandlerFunc) http.HandlerFunc

func EchoSetMaintenanceMode

func EchoSetMaintenanceMode(fileName string) echo.MiddlewareFunc

func EchoSetNoCache

func EchoSetNoCache(next echo.HandlerFunc) echo.HandlerFunc

func EchoSetRequestID

func EchoSetRequestID(next echo.HandlerFunc) echo.HandlerFunc

func EchoSetRouteList

func EchoSetRouteList(routes []*echo.Route) map[string]map[string]string

func Log

func Log(next http.HandlerFunc) http.HandlerFunc

func PrivateKey

func PrivateKey(next http.HandlerFunc) http.HandlerFunc

func Timestamp

func Timestamp(next http.HandlerFunc) http.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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