First try

This commit is contained in:
Dan Dobos
2021-11-01 09:14:39 +01:00
parent 7062f79255
commit 43380ec064
15 changed files with 1195 additions and 0 deletions
@@ -0,0 +1,29 @@
package app
import (
"fmt"
"net/http"
"github.com/diaid83/pokemongotemplates/internal/domain/pokemongotemplates"
"github.com/gin-gonic/gin"
)
func (s *ApplicationServer) pokemonPageHandler() func(*gin.Context) {
data, err := pokemongotemplates.GetPokemons()
if err != nil {
fmt.Println(err.Error())
}
return func(c *gin.Context) {
c.HTML(http.StatusOK, "views/Pokemons.gohtml", pokemongotemplates.PageData{
NavigationLinks: pokemongotemplates.NavigationLinks,
Data: *data,
})
}
}
func (s *ApplicationServer) customPokemonPageHandler() func(*gin.Context) {
return func(c *gin.Context) {
c.HTML(http.StatusOK, "views/CustomPokemons.gohtml", pokemongotemplates.PageData{
NavigationLinks: pokemongotemplates.NavigationLinks,
})
}
}