handlers

package
v0.0.0-...-e3cadf0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package handlers provides the HTTP handlers for the API server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datalayer

type Datalayer interface {
	CreateUser(ctx context.Context, user models.User) error
	SignInUser(ctx context.Context, username, password string) (string, error)
	GetUserById(ctx context.Context, id int) (models.UserInfo, error)
}

Datalayer is an interface that defines the methods for the datalayer.

type Endpoints

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

Endpoints is a struct that defines the handler for the MADR endpoints.

func New

func New(data Datalayer, ew ErrorWriter, logger Logger) *Endpoints

New is a constructor for the Endpoints struct.

func (*Endpoints) GetUserInfo

func (e *Endpoints) GetUserInfo(w http.ResponseWriter, r *http.Request)

GetUserInfo is a handler for the get-user-info endpoint.

func (*Endpoints) SignIn

func (e *Endpoints) SignIn(w http.ResponseWriter, r *http.Request)

SignIn is a handler for the sign-in endpoint.

func (*Endpoints) SignUp

func (e *Endpoints) SignUp(w http.ResponseWriter, r *http.Request)

SignUp is a handler for the sign-up endpoint.

type ErrorWriter

type ErrorWriter interface {
	Error(w http.ResponseWriter, msg string, status int)
}

ErrorWriter is an interface that defines the methods for the error writer.

type Logger

type Logger interface {
	Error(msg interface{}, keyvals ...interface{})
}

Logger is an interface that defines the methods for the logger.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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