Implemented API endpoint to update skin information

Added tests to jwt package
Reworked redis backend implementation
Skin repository now have methods to remove skins by user id or username
This commit is contained in:
ErickSkrauch
2018-01-23 18:43:37 +03:00
parent aaff88d32f
commit f120064fe3
14 changed files with 923 additions and 55 deletions

View File

@@ -22,6 +22,7 @@ type Config struct {
SkinsRepo interfaces.SkinsRepository
CapesRepo interfaces.CapesRepository
Logger wd.Watchdog
Auth interfaces.AuthChecker
}
func (cfg *Config) Run() error {
@@ -59,6 +60,8 @@ func (cfg *Config) CreateHandler() http.Handler {
// Legacy
router.HandleFunc("/skins", cfg.SkinGET).Methods("GET")
router.HandleFunc("/cloaks", cfg.CapeGET).Methods("GET")
// API
router.Handle("/api/skins", cfg.Authenticate(http.HandlerFunc(cfg.PostSkin))).Methods("POST")
// 404
router.NotFoundHandler = http.HandlerFunc(cfg.NotFound)