cors

package module
v0.0.0-...-2480b60 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: MIT Imports: 5 Imported by: 0

README

gin-cors

Build Status

CORS middleware for Gin.

Installation

$ go get github.com/tommy351/gin-cors

Usage

import (
    "github.com/gin-gonic/gin"
    "github.com/tommy351/gin-cors"
)

func main(){
    g := gin.New()
    g.Use(cors.Middleware(cors.Options{}))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(options Options) gin.HandlerFunc

Middleware sets CORS headers for every request

Types

type Options

type Options struct {
	AllowOrigins     []string
	AllowCredentials bool
	AllowMethods     []string
	AllowHeaders     []string
	ExposeHeaders    []string
	MaxAge           time.Duration
}

Options stores configurations

Jump to

Keyboard shortcuts

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