cors

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

README

CORS Plugin

The CORS plugin enables the configuration of CORS headers when running micro.

## Usage

Register the plugin before building Micro

package main

import (
    "github.com/micro/micro/plugin"
    "github.com/micro/go-plugins/micro/cors"
)

func init() {
    plugin.Register(cors.NewPlugin())
}

Configuration

### Environment variables

CORS_ALLOWED_HEADERS="X-Custom-Header"
CORS_ALLOWED_ORIGINS="*"
CORS_ALLOWED_METHODS="POST"

### Command line

$ micro api \
    --cors-allowed-headers=X-Custom-Header \
    --cors-allowed-origins=someotherdomain.com \
    --cors-allowed-methods=POST

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPlugin

func NewPlugin() plugin.Plugin

NewPlugin Creates the CORS Plugin

Types

This section is empty.

Jump to

Keyboard shortcuts

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