package
0.0.0-20230307183559-2da11fd39fb3
Repository: https://github.com/ngamux/middleware.git
Documentation: pkg.go.dev

# README

CORS

Middleware to manage CORS.

Usage

Import

import "github.com/ngamux/middleware/cors"

Instance With Default Config

corsMiddleware := cors.New()

Instance With Custom Config

corsMiddleware := cors.New(cors.Config{
  AllowOrigins: "https://github.com, https://apps.github.com",
  AllowHeaders:  "Origin, Content-Type, Accept",
  AllowMethods:     "GET,POST,HEAD,PUT,DELETE,PATCH",
})

Mount Instance to Ngamux

Global Middleware

mux := ngamux.New()
mux.Use(corsMiddleware)

Route Middleware

mux := ngamux.New()
mux.Get("/", corsMiddleware(handler))

or

mux := ngamux.New()
mux.Get("/", ngamux.WithMiddlewares(corsMiddleware)(handler))

# Functions

No description provided by the author

# Structs

No description provided by the author