gin
以下のように、ルーティング設定すると、 controller.Router.GET("/shops/:shop_id", controller.getShop) controller.Router.GET("/shops/new", controller.newShop) 以下のエラーが発生する。 panic: wildcard route ':shop_id' conflicts with existing c…
いままでこんな書き方してたが冗長。 func (controller *ShopsController) Setup() { controller.Router.POST("/shops", controller.createShop) controller.Router.GET("/shops", controller.listShops) controller.Router.GET("/shops/:shop_id", controll…
テンプレートの優先順。 ginのテンプレートの機能で以下のようにテンプレートを読む設定する。 router := gin.Default() router.LoadHTMLGlob("templates/*/*.tmpl") こうすればtemplates/なんとか の[なんとか]が自由になる。 templates/shop/index.tmpl te…
hoge変数がbarという文字と比較。 {{ if $hoge eq “bar” }}ではない。ポーランド記法。 {{ if eq $hoge "bar" }} {{else}} {{end}} ja.stackoverflow.com