// デフォルトのミドルウェアが何もない router を作成する
// Logger ミドルウェアは GIN_MODE=release を設定してても、 gin.DefaultWriter にログを出力する
// gin.DefaultWriter はデフォルトでは os.Stdout。
// Recovery ミドルウェアは panic が発生しても 500 エラーを返してくれる
router.Use(gin.Recovery())
// 個別のルーティングに、ミドルウェアを好きに追加することもできる
router.GET("/benchmark", MyBenchLogger(), benchEndpoint)
// authorized := router.Group("/", AuthRequired())
authorized := router.Group("/")
// 個別のグループのミドルウェア。この例では、AuthRequired() ミドルウェアを認証が必要なグループに設定している。
authorized.Use(AuthRequired())
authorized.POST("/login", loginEndpoint)
authorized.POST("/submit", submitEndpoint)
authorized.POST("/read", readEndpoint)
testing := authorized.Group("testing")
testing.GET("/analytics", analyticsEndpoint)
// 0.0.0.0:8080 でサーバーを立てる