handler

package
v0.0.0-...-d6efe1e Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAPIHandler

func NewAPIHandler(db DBProvider, log *logger.Log, authorizer auth.Authenticator) (http.Handler, error)

Types

type APIHandler

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

func (*APIHandler) CreateNewPost

func (a *APIHandler) CreateNewPost(w http.ResponseWriter, r *http.Request)

(POST /v1/posts

func (*APIHandler) GetAllPosts

func (a *APIHandler) GetAllPosts(w http.ResponseWriter, r *http.Request)

(GET /v1/post

type Claims

type Claims struct {
	Sub   string `json:"sub"`
	Email string `json:"email"`
}

type DBProvider

type DBProvider interface {
	GetPosts(context.Context) ([]store.Post, error)
	CreateNewPost(context.Context, store.CreatePost) (store.Post, error)
	GetUserByID(context.Context, string) (store.User, error)
}

Jump to

Keyboard shortcuts

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