http

package
v0.0.0-...-f39411c Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ContextKeyCurrentUser defines the name of the key in our echo.Context to get CurrentUser if any
	ContextKeyCurrentUser = "CUser_"
	// ContextKeySession defines the name of the key in our echo.Contexdt to get Session of the CurrentUser if any
	ContextKeySession = "Session_"
	// HeaderKeyAuthorization defines the name of the header that should be set in the request to authentify the user
	HeaderKeyAuthorization = "X-Authorization"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPResponse

type HTTPResponse struct {
	Status HTTPResponseStatus `json:"status"`
	Data   interface{}        `json:"data"`
}

func HandleHTTPResponse

func HandleHTTPResponse(statusCode int, message string, data interface{}) HTTPResponse

type HTTPResponseStatus

type HTTPResponseStatus struct {
	Error   bool   `json:"error"`
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Server

type Server struct {
	Router *echo.Echo
	Port   string

	Middlewares    *middlewares
	UserService    *backapi.UserService
	SessionService *backapi.SessionService
}

func NewServer

func NewServer(
	UserService *backapi.UserService,
	SessionService *backapi.SessionService) *Server

NewServer returns a new instantiated Server with all the fields filled The logic and configuration itself is done only on the Setup step

func (*Server) Setup

func (s *Server) Setup() error

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop() error

type SessionHandler

type SessionHandler struct {
	SessionService *backapi.SessionService
}

func (*SessionHandler) CreateSession

func (h *SessionHandler) CreateSession(c echo.Context) error

func (*SessionHandler) RemoveSession

func (h *SessionHandler) RemoveSession(c echo.Context) error

type UserHandler

type UserHandler struct {
	// Defines required Services here
	UserService *backapi.UserService
}

func (*UserHandler) CreateUser

func (h *UserHandler) CreateUser(c echo.Context) error

func (*UserHandler) GetCUser

func (h *UserHandler) GetCUser(c echo.Context) error

func (*UserHandler) UserChangeEmail

func (h *UserHandler) UserChangeEmail(c echo.Context) error

func (*UserHandler) UserChangePassword

func (h *UserHandler) UserChangePassword(c echo.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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