package main import ( "iris-test/app/cfg" "iris-test/app/db" "iris-test/app/logging" "github.com/kataras/iris/v12" ) type User struct { firstName string lastName string email string } var users = []User{ { firstName: "Pero", lastName: "Perić", email: "pero@gmail.com", }, { firstName: "Mirko", lastName: "Mirković", email: "mirko@gmail.com", }, { firstName: "Ivo", lastName: "Ivić", email: "ivo@gmail.com", }, { firstName: "Slavko", lastName: "Slavković", email: "slavko@gmail.com", }, } func main() { cfg.Init() logging.Init() db.InitDB() app := iris.New() app.RegisterView(iris.Jet("./app/templates", ".jet").Reload(true)) // mypathRoute := app.Get("/mypath", writePathHandler) // mypathRoute.Name = "my-page1" // mypath2Route := app.Get("/mypath2/{paramfirst}/{paramsecond}", writePathHandler) // mypath2Route.Name = "my-page2" // mypath3Route := app.Get("/mypath3/{paramfirst}/statichere/{paramsecond}", writePathHandler) // mypath3Route.Name = "my-page3" // mypath4Route := app.Get("/mypath4/{paramfirst}/statichere/{paramsecond}/{otherparam}/{something:path}", writePathHandler) // // same as: app.Get("/mypath4/:paramfirst/statichere/:paramsecond/:otherparam/*something", writePathHandler) // mypath4Route.Name = "my-page4" // // same with Handle/Func // mypath5Route := app.Handle("GET", "/mypath5/{paramfirst:int}/statichere/{paramsecond}/{otherparam}/anything/{something:path}", writePathHandlerPage5) // mypath5Route.Name = "my-page5" // mypath6Route := app.Get("/mypath6/{paramfirst}/{paramsecond}/statichere/{paramThirdAfterStatic}", writePathHandler) // mypath6Route.Name = "my-page6" app.Get("/", func(ctx iris.Context) { // templateContext := map[string]string{} params1 := []string{"param 1", "param 2", "param 3"} ctx.ViewData("params1", params1) ctx.ViewData("users", users) if err := ctx.View("pages/index.jet"); err != nil { ctx.HTML("