// Logger 中间件将日志写入 gin.DefaultWriter,即使你将 GIN_MODE 设置为 release。
// By default gin.DefaultWriter = os.Stdout
// Recovery 中间件会 recover 任何 panic。如果有 panic 的话,会写入 500。
router.Use(gin.Recovery())
router.GET("/benchmark", MyBenchLogger(), benchEndpoint)
// authorized := router.Group("/", AuthRequired())
authorized := router.Group("/")
// 路由组中间件! 在此例中,我们在 "authorized" 路由组中使用自定义创建的
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 上启动服务