router

package
v0.0.0-...-68c1abf Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 7 Imported by: 0

README

router

-- import "github.com/rickbassham/example-go/chiapi/router"

Package router is used to define the routes to our request handlers.

Usage

func NewRouter
func NewRouter(h Handler, log *zap.Logger, nr newrelic.Application, tokenAuth *jwtauth.JWTAuth, version, corsOrigin string) http.Handler

NewRouter creates a new CORS enabled router for our API. All requests will be logged and instrumented with New Relic.

type Handler
type Handler interface {
	Health(w http.ResponseWriter, r *http.Request)
	Protected(w http.ResponseWriter, r *http.Request)
	NotFound(w http.ResponseWriter, r *http.Request)
	Unauthorized(w http.ResponseWriter, r *http.Request)
}

Handler exposes the functions for handling web requests.

Documentation

Overview

Package router is used to define the routes to our request handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(h Handler, log *zap.Logger, nr newrelic.Application, tokenAuth *jwtauth.JWTAuth, version, corsOrigin string) http.Handler

NewRouter creates a new CORS enabled router for our API. All requests will be logged and instrumented with New Relic.

Types

type Handler

type Handler interface {
	Health(w http.ResponseWriter, r *http.Request)
	Cached(w http.ResponseWriter, r *http.Request)
	Protected(w http.ResponseWriter, r *http.Request)
	NotFound(w http.ResponseWriter, r *http.Request)
	Unauthorized(w http.ResponseWriter, r *http.Request)
}

Handler exposes the functions for handling web requests.

Jump to

Keyboard shortcuts

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