cors

package module
v0.0.0-...-dc91dec Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: MIT Imports: 5 Imported by: 16

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