httpserver

package
v0.0.0-...-2db41fb Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package httpserver implements HTTP handlers using chi.NewRouter

Package httpserver implements the creation and launch of a server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(conf *config.Config, store storage.Storage, parser jwt.Parser) chi.Router

NewRouter constructor of our routing object

Types

type HTTPServer

type HTTPServer struct {
	Conf *config.Config
}

HTTPServer structure of our HTTPS server. Implements the Server interface

func (*HTTPServer) Run

func (s *HTTPServer) Run() error

Run a blocking function for starting the server

type Handler

type Handler struct {
	*chi.Mux
	// contains filtered or unexported fields
}

Handler structure implements chi.Mux for routing functionality

func (*Handler) AddBinary

func (h *Handler) AddBinary() http.HandlerFunc

AddBinary register binary data by user and ID @Tags Add @Summary Registering a new set of binary data @Description Registration is performed using a unique pair of User ID + Card ID. @ID addBinary @Accept json @Produce plain @Param binary_data body Binary true "Binary object" @Success 200 {string} string "ok" @Failure 400 {string} string "invalid deserialization" @Failure 409 {string} string "" @Failure 500 {string} string "read data problem" @Router /api/text [post]

func (*Handler) AddCard

func (h *Handler) AddCard() http.HandlerFunc

AddCard register a new card @Tags Add @Summary Registering a new card @Description Registration is performed using a unique pair of User ID + Card ID. @ID addCard @Accept json @Produce plain @Param card_data body Card true "Card object" @Success 200 {string} string "ok" @Failure 400 {string} string "invalid deserialization" @Failure 409 {string} string "" @Failure 500 {string} string "read data problem" @Router /api/card [post]

func (*Handler) AddLogin

func (h *Handler) AddLogin() http.HandlerFunc

AddLogin register a new login @Tags Add @Summary Registering a new login @Description Registration is performed using a unique pair of User ID + Card ID. @ID addLogin @Accept json @Produce plain @Param login_data body Login true "Login object" @Success 200 {string} string "ok" @Failure 400 {string} string "invalid deserialization" @Failure 409 {string} string "" @Failure 500 {string} string "read data problem" @Router /api/login [post]

func (*Handler) AddText

func (h *Handler) AddText() http.HandlerFunc

AddText register a new text by user and ID @Tags Add @Summary Registering a new text @Description Registration is performed using a unique pair of User ID + Card ID. @ID addText @Accept json @Produce plain @Param text_data body Text true "Text object" @Success 200 {string} string "ok" @Failure 400 {string} string "invalid deserialization" @Failure 409 {string} string "" @Failure 500 {string} string "read data problem" @Router /api/text [post]

func (*Handler) Binary

func (h *Handler) Binary() http.HandlerFunc

Binary return specific binary data @Tags Read @Summary Returns user binary data @Description input rest URL, output JSON value @ID readBinary @Produce json @Param id path string true "Binary ID" @Success 200 {object} Binary @Failure 404 {string} string "" @Failure 500 {string} string "" @Router /api/text/{id} [get]

func (*Handler) Card

func (h *Handler) Card() http.HandlerFunc

Card return specific card data @Tags Read @Summary Returns user card data @Description input rest URL, output JSON value @ID readCard @Produce json @Param id path string true "Card ID" @Success 200 {object} Card @Failure 404 {string} string "" @Failure 500 {string} string "" @Router /api/card/{id} [get]

func (*Handler) DeleteBinary

func (h *Handler) DeleteBinary() http.HandlerFunc

DeleteBinary delete binary data by user and ID @Tags Delete @Summary Deleting binary data @Description Deletion is performed using a unique pair of User ID + Card ID. @ID delBinary @Produce plain @Param id path string true "Binary ID" @Success 200 {string} string "ok" @Failure 500 {string} string "" @Router /api/text [delete]

func (*Handler) DeleteCard

func (h *Handler) DeleteCard() http.HandlerFunc

DeleteCard delete a card by user and ID @Tags Delete @Summary Deleting a card @Description Deletion is performed using a unique pair of User ID + Card ID. @ID delCard @Produce plain @Param id path string true "Card ID" @Success 200 {string} string "ok" @Failure 500 {string} string "" @Router /api/card [delete]

func (*Handler) DeleteLogin

func (h *Handler) DeleteLogin() http.HandlerFunc

DeleteLogin delete a login by user and ID @Tags Delete @Summary Deleting a login @Description Deletion is performed using a unique pair of User ID + Card ID. @ID delLogin @Produce plain @Param id path string true "Login ID" @Success 200 {string} string "ok" @Failure 500 {string} string "" @Router /api/login [delete]

func (*Handler) DeleteText

func (h *Handler) DeleteText() http.HandlerFunc

DeleteText delete text by user and ID @Tags Delete @Summary Deleting text @Description Deletion is performed using a unique pair of User ID + Card ID. @ID delText @Produce plain @Param id path string true "Text ID" @Success 200 {string} string "ok" @Failure 500 {string} string "" @Router /api/text [delete]

func (*Handler) Login

func (h *Handler) Login() http.HandlerFunc

Login return specific login data @Tags Read @Summary Returns user login data @Description input rest URL, output JSON value @ID readLogin @Produce json @Param id path string true "Login ID" @Success 200 {object} Login @Failure 404 {string} string "" @Failure 500 {string} string "" @Router /api/login/{id} [get]

func (*Handler) Register

func (h *Handler) Register() http.HandlerFunc

Register register user

func (*Handler) SignIn

func (h *Handler) SignIn() http.HandlerFunc

SignIn authentication

func (*Handler) Text

func (h *Handler) Text() http.HandlerFunc

Text return specific text data @Tags Read @Summary Returns user text data @Description input rest URL, output JSON value @ID readText @Produce json @Param id path string true "Text ID" @Success 200 {object} Text @Failure 404 {string} string "" @Failure 500 {string} string "" @Router /api/text/{id} [get]

Jump to

Keyboard shortcuts

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