cors

package module
Version: v2.0.0-...-cabcc6b Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 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/api/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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL