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: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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