Skip to content

Instantly share code, notes, and snippets.

@syrm
Last active July 12, 2021 19:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save syrm/ab91e433f37844d35dab809f153ca0eb to your computer and use it in GitHub Desktop.
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