Skip to content

Instantly share code, notes, and snippets.

@syrm
Last active Jul 12, 2021
Embed
What would you like to do?
type Home struct {
Database *gorm.DB
Sessions *sessions.Sessions
ImagePath string
}
func (c *Home) AfterActivation(a mvc.AfterActivation) {
a.GetRoute("Get").Name = "home"
a.GetRoute("GetBy").Name = "home/voiture"
}
func (c *Home) GetBy(name string) mvc.Result {
println("Youuuuuuuuuuuuuu " + name)
...
mvc.Configure(app.Party("/"), func(app *mvc.Application) {
app.Register(logger, database, sessions)
base(app, logger, database, sessions)
})
func base(app *mvc.Application, logger *zerolog.Logger, database *gorm.DB, sessions *sessions.Sessions) {
app.Handle(&controllers.Home{
Database: database,
Sessions: sessions,
ImagePath: os.Getenv("WEB_IMAGE_PATH"),
})
}
i go on http://localhost:8080/toto
i get : Youuuuuuuuuuuuuu ../data/web/images/
instead : Youuuuuuuuuuuuuu toto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment