forked from Red-Store/BACK-END
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
32 lines (25 loc) · 759 Bytes
/
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
package main
import (
"MyEcommerce/app/config"
"MyEcommerce/app/database"
"MyEcommerce/app/router"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
cfg := config.InitConfig()
dbSql := database.InitDBMysql(cfg)
e := echo.New()
e.Use(middleware.CORS())
e.Pre(middleware.RemoveTrailingSlash())
// e.Use(middleware.Logger())
// e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
// Format: "method=${method}, uri=${uri}, status=${status}\n",
// }))
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
Format: `[${time_rfc3339}] ${status} ${method} ${host}${path} ${latency_human}` + "\n",
}))
router.InitRouter(dbSql, e)
//start server and port
e.Logger.Fatal(e.Start(":8000"))
}