go_mux

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

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

Go to latest
Published: Apr 22, 2019 License: MIT Imports: 9 Imported by: 0

README

Using Optic with Go + Mux

Integrating Optic if you are using Mux with Go is as easy as using the Optic Middleware via Mux's Router.Use(Middleware) functionality.

package main

import (
	"github.com/gorilla/mux"
	optic "github.com/opticdev/api-ingestion/integrations/go-mux"
	"log"
	"net/http"
	"os"
)

func main() {
	r := mux.NewRouter();
	r.Use(optic.Middleware)
	r.PathPrefix("/").HandlerFunc(<YourHandler>)

	log.Fatal(http.ListenAndServe(":8080", r))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(next http.Handler) http.Handler

func WrapReader

func WrapReader(source io.ReadCloser) (firstReader io.ReadCloser, secondReader io.ReadCloser)

func WriteResponse

func WriteResponse(response *http.Response, w http.ResponseWriter)

Types

This section is empty.

Jump to

Keyboard shortcuts

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