-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (29 loc) · 790 Bytes
/
main.go
File metadata and controls
36 lines (29 loc) · 790 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
31
32
33
34
35
36
package main
import (
"fmt"
"recything/app/config"
"recything/app/database"
"recything/app/route"
"recything/utils/storage"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
e := echo.New()
cfg := config.InitConfig()
dbMysql := database.InitDBMysql(cfg)
database.InitMigrationMysql(dbMysql)
supabase := storage.InitStorage(cfg)
redis := database.InitRedis(cfg)
e.Pre(middleware.RemoveTrailingSlash())
e.Use(middleware.CORS())
route.New(e, dbMysql, supabase, redis)
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
Format: `[${time_rfc3339}] ${status} ${method} ${host}${path} ${latency_human}` + "\n",
}))
port := cfg.SERVERPORT
if port == 0 {
port = 8000
}
e.Logger.Fatal(e.Start(fmt.Sprintf(":%d", port)))
}