forked from Hannon-App/be-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
30 lines (24 loc) · 663 Bytes
/
Copy pathmain.go
File metadata and controls
30 lines (24 loc) · 663 Bytes
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
package main
import (
"Hannon-app/app/config"
"Hannon-app/app/database"
"Hannon-app/app/router"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
cfg := config.InitConfig()
dbMysql := database.InitMysql(cfg)
database.InittialMigration(dbMysql)
// create a new echo instance
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",
}))
router.InitRouter(dbMysql, e, cfg)
//start server and port
e.Logger.Fatal(e.Start(":80"))
}