handlers

package
v0.0.0-...-79ea3da Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package classification Snippets API

Documentation for Snippets API used for database manipulation

	Schemes: https
	BasePath: /
	Version: 0.0.4
	Contact: Vitor Graveto<vitor@wexcedo.com>

	Consumes:
	- application/json

	Produces:
	- application/json

 SecurityDefinitions:
 snippetskey:
   type: apiKey
   description: JSON Web Token (JWT) - token
   name: Authentication
   in: header

swagger:meta

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMiddleware

func AddMiddleware(h http.Handler, middleware ...func(http.Handler) http.Handler) http.Handler

AddMiddleware adds middleware to a Handler

Types

type Application

type Application struct {
	DebugOn  bool
	ErrorLog *log.Logger
	InfoLog  *log.Logger
	Snippets models.Snippets
	Users    models.Users
	Tokens   models.Tokens
	Val      *models.Validation
}

Define an application struct to hold the application-wide dependencies for the API application. This will allow us to make the objects available to our handlers.

func (*Application) Routes

func (app *Application) Routes() http.Handler

func (*Application) ValidateJSONBody

func (app *Application) ValidateJSONBody(dataObj, contextKey interface{}) func(next http.Handler) http.Handler

ValidateJSONBody provides JSON body read and validation middleware for handlers reads the JSON body to a given data object and validates its content adds that data to the request context when valid and calls the next handler otherwise aborts the request returning the response message with information

type KeyChangeUserPassword

type KeyChangeUserPassword struct{}

KeyChangeUserPassword is a key used for ChangeUserPassword object in the context

type KeyCreateUser

type KeyCreateUser struct{}

KeyCreateUser is a key used for CreateUser object in the context

type KeyLoginUser

type KeyLoginUser struct{}

KeyLoginUser is a key used for the LoginUser object in the context

type KeySnippetCreate

type KeySnippetCreate struct{}

KeySnippet is a key used for the Snippet object in the context

type KeyTokenUser

type KeyTokenUser struct{}

KeyTokenUser is a key used for the TokenUser object in the context

Jump to

Keyboard shortcuts

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