rest

package
v0.0.0-...-e85117a Latest Latest
Warning

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

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

Documentation

Overview

Golang SwaggerUI

Schemes: https, http
BasePath: /api
Version: 1.0.0

Consumes:
- application/json

Produces:
- application/json

swagger:meta

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Router *httprouter.Router
	Log    *logrus.Logger
}

API def

func NewAPI

func NewAPI(router *httprouter.Router, logger *logrus.Logger) *API

NewAPI ...

func (*API) ListenAndServe

func (api *API) ListenAndServe(addr string) error

ListenAndServe always returns a non-nil error.

func (*API) WriteJSONResponse

func (*API) WriteJSONResponse(w http.ResponseWriter, status int, response interface{})

WriteJSONResponse to response writer

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

The type of our middleware consists of the original handler we want to wrap and a message

func NewMiddleware

func NewMiddleware(next http.Handler, logger *logrus.Logger, message string) *Middleware

Make a constructor for our middleware type since its fields are not exported (in lowercase)

func (*Middleware) ServeHTTP

func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

Our middleware handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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