forked from ellcontreras/exons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
39 lines (28 loc) · 741 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
33
34
35
36
37
38
package main
import (
"github.com/labstack/echo/middleware"
"exons/routes"
"github.com/labstack/echo"
)
var (
//Server is the server of the app
Server *echo.Echo
)
func main() {
Server = echo.New()
Server.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"*"},
}))
Server.Use(middleware.LoggerWithConfig(
middleware.LoggerConfig{
Format: `{"time":"${time_rfc3339_nano}","host":"${host}","method":"${method}","uri":"${uri}","status":${status},`+
`"bytes_in":${bytes_in},` + `"bytes_out":${bytes_out}}` + "\n",
},
))
//Init the routes
routes.InitRoutes(Server)
//Make migrations
//db := DB.Open()
//db.AutoMigrate(&models.Product{})
Server.Logger.Fatal(Server.Start(":8080"))
}