-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
51 lines (38 loc) · 1.01 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
42
43
44
45
46
47
48
49
50
51
package main
import (
config "Laptop/app/configs"
"Laptop/app/database"
router "Laptop/app/routers"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
// logging := helpers.NewLogger()
cfg := config.InitConfig()
dbMysql := database.InitDBMysql(cfg)
//call migration
database.InitialMigration(dbMysql)
//create a new echo instance
e := echo.New()
e.Use(middleware.CORS())
//remove pre trailingslash
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)
//start server and port
e.Logger.Fatal(e.Start(":8083"))
}
// func customTLSConfig() (*tls.Config, error) {
// caCert, err := ioutil.ReadFile("server-ca.pem")
// if err != nil {
// return nil, err
// }
// certPool := x509.NewCertPool()
// certPool.AppendCertsFromPEM(caCert)
// return &tls.Config{
// RootCAs: certPool,
// }, nil
// }