-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (38 loc) · 1.22 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
_ "Blog_API/docs"
"Blog_API/pkg/containers"
"Blog_API/pkg/utils/response"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
m "github.com/labstack/echo/v4/middleware"
echoSwagger "github.com/swaggo/echo-swagger"
)
// swagger docs
// @title Blog API
// @version 1.0
// @description This is a sample server for Blog CRUD Operation
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host localhost:8080
// @BasePath /blog_api/v1
func main() {
e := echo.New()
e.Use(middleware.CORS())
e.Pre(m.RemoveTrailingSlash())
e.Use(m.LoggerWithConfig(m.LoggerConfig{
Format: `${time_custom} ${remote_ip} ${host} ${method} ${uri} ${status} ${latency_human} ${bytes_in} ${bytes_out} "${user_agent}"` + "\n",
CustomTimeFormat: "2006-01-02T15:04:05.00",
}))
e.Use(m.Secure())
e.Use(m.Recover())
e.GET("/swagger/*", echoSwagger.WrapHandler)
e.GET("/h3a1t5", func(c echo.Context) error {
return response.SuccessResponse(c, "Health Check", "Server is running")
})
containers.Serve(e)
}