middlewares

package
v0.0.0-...-17f76c2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package middlewares implments a collection of useful and commonly used middlewares for http servers that are based on go's standard net/http library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cors

func Cors(next http.HandlerFunc) http.HandlerFunc

Cors handles preflight

func JWT

func JWT(secret string) func(next http.HandlerFunc) http.HandlerFunc

JWT - uses the popular dgrijalva/jwt-go to handle request authentication via jwt using the HMAC signing method. in its argument, you must pass in the secret used when signing the returned value is your middleware

func Log

func Log(next http.HandlerFunc) http.HandlerFunc

Log - uses logrus library to handles logging of common request fields

Types

type ContextKey

type ContextKey string

ContextKey implements type for context key

const ContextJWTKey ContextKey = "jwt"

ContextJWTKey is the key for the jwt context value

Jump to

Keyboard shortcuts

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