gomiddleware

package module
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 8 Imported by: 1

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 added in v1.1.0

func Acceptable(next http.HandlerFunc) http.HandlerFunc

func AppID added in v1.1.0

func AppID(next http.HandlerFunc) http.HandlerFunc

func ClientID added in v1.1.0

func ClientID(next http.HandlerFunc) http.HandlerFunc

func ContentType added in v1.3.0

func ContentType(next http.HandlerFunc) http.HandlerFunc

func EchoSetMaintenanceMode added in v1.3.4

func EchoSetMaintenanceMode(fileName string) echo.MiddlewareFunc

func EchoSetNoCache added in v1.3.2

func EchoSetNoCache(next echo.HandlerFunc) echo.HandlerFunc

func EchoSetRequestID added in v1.3.2

func EchoSetRequestID(next echo.HandlerFunc) echo.HandlerFunc

func EchoSetRouteList added in v1.3.2

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

func Log

func Log(next http.HandlerFunc) http.HandlerFunc

func PrivateKey added in v1.2.0

func PrivateKey(next http.HandlerFunc) http.HandlerFunc

func Timestamp added in v1.1.0

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