Thanks to visit codestin.com
Credit goes to pkg.go.dev

middlewares

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package middlewares contains Gin HTTP middlewares used by the restapi server (CORS, logging, no-cache).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

CORSMiddleware sets Cross-Origin Resource Sharing (CORS) headers to allow requests across origins. Handles preflight requests by responding with status 200 for OPTIONS method. Configures allowed origins, methods, headers, credentials, and max age for caching.

func NoCache

func NoCache() gin.HandlerFunc

NoCache is a middleware function that sets headers to prevent HTTP response caching and removes ETag-related request headers.

func RequestLogger

func RequestLogger() gin.HandlerFunc

RequestLogger is a middleware for logging details of HTTP requests, including method, path, status, content length, referrer, user agent, and request body if applicable, excluding GET requests. It ensures detailed request monitoring and is designed for use with the Gin framework.

Types

This section is empty.

Jump to

Keyboard shortcuts

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