handlers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJSON = "application/json"
)

Variables

This section is empty.

Functions

func GetAlbum

func GetAlbum(w http.ResponseWriter, r *http.Request)

func GetAlbums

func GetAlbums(w http.ResponseWriter, r *http.Request)

func GetArtist

func GetArtist(w http.ResponseWriter, r *http.Request)

func GetArtists

func GetArtists(w http.ResponseWriter, r *http.Request)

func GetPicture

func GetPicture(w http.ResponseWriter, r *http.Request)

func GetRandomSong

func GetRandomSong(w http.ResponseWriter, r *http.Request)

func GetSong

func GetSong(w http.ResponseWriter, r *http.Request)

func GetSongs

func GetSongs(w http.ResponseWriter, r *http.Request)

func GetStats

func GetStats(w http.ResponseWriter, r *http.Request)

func HandleError

func HandleError(w http.ResponseWriter, status int, err error, display string)

func ListenToSong

func ListenToSong(w http.ResponseWriter, r *http.Request)

func NotFoundHandler

func NotFoundHandler(w http.ResponseWriter, r *http.Request)

func StartServer

func StartServer(c *ServerConfig)

func WriteJSON

func WriteJSON(w http.ResponseWriter, status int, data interface{})

Types

type Data added in v0.3.0

type Data interface {
	[]database.Album | []database.Song | []database.Artist
}

type ServerConfig

type ServerConfig struct {
	ApiOnly bool
	Assets  embed.FS
	PORT    int
	TLS     struct {
		Enabled  bool
		CertFile string
		KeyFile  string
	}
}

func (*ServerConfig) StringifyPort

func (c *ServerConfig) StringifyPort() string

Jump to

Keyboard shortcuts

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