Added support for fetching character images from the server

This commit is contained in:
2025-01-14 10:01:48 +01:00
parent 5b640375c3
commit db8214cb02
4 changed files with 50 additions and 3 deletions

View File

@@ -26,3 +26,13 @@ func (i *IndexHandler) GetDBTest(ctx echo.Context) error {
backend.TestDB()
return ctx.JSON(http.StatusOK, "TestedDB")
}
func (i *IndexHandler) GetCharacters(ctx echo.Context) error {
characters := backend.GetCharacters()
return ctx.JSON(http.StatusOK, characters)
}
func (i *IndexHandler) GetCharacter(ctx echo.Context) error {
character := ctx.QueryParam("character")
return ctx.File(backend.GetCharacter(character))
}

View File

@@ -39,6 +39,8 @@ func (s *Server) RegisterRoutes() http.Handler {
index := NewIndexHandler()
e.GET("/version", index.GetVersion)
e.GET("/health", index.GetDBTest)
e.GET("/character", index.GetCharacter)
e.GET("/characters", index.GetCharacters)
sync := NewSyncHandler()
syncGroup := e.Group("/sync")