handlers

package
v0.0.0-...-aea6139 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package handlers provides the http functionality for the URL Shortener

Index

Constants

This section is empty.

Variables

View Source
var DoNotPrivateKeyChecking = false

DoNotPrivateKeyChecking is used for testing

Functions

func Ginrus

func Ginrus(logger loggerEntryWithFields, timeFormat string, utc bool, notlogged ...string) gin.HandlerFunc

Ginrus returns a gin.HandlerFunc (middleware) that logs requests using logrus.

Requests with errors are logged using logrus.Error(). Requests without errors are logged using logrus.Info().

It receives:

  1. A time package format string (e.g. time.RFC3339).
  2. A boolean stating whether to use UTC time zone or local.
  3. Optionally, a list of paths to skip logging for (this is why we are not using upstream github.com/gin-gonic/contrib/ginrus)

Types

type Handler

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

Handler holds the funcs and attributes for the http communication

func New

func New(store stores.Store) (*Handler, error)

New initializes the http handlers

func (*Handler) CloseStore

func (h *Handler) CloseStore() error

CloseStore stops the http server and the closes the db gracefully

func (*Handler) Listen

func (h *Handler) Listen() error

Listen starts the http server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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