-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (37 loc) · 893 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
39
40
41
42
43
44
45
46
47
48
49
package main
import (
_ "github.com/joho/godotenv/autoload"
"github.com/labstack/echo/v4"
"github.com/labstack/gommon/log"
"goBoilterplate/app/models"
"goBoilterplate/app/router"
"goBoilterplate/config"
"gopkg.in/tylerb/graceful.v1"
"time"
)
// @title Golang Echo API
// @version 1.0
// @description API documentation by Swagger
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name Authorization
var (
Version = "dev"
)
func main() {
app := echo.New()
app.Logger.SetLevel(log.INFO)
app.Logger.Info("Http server started with version ", Version)
db, err := config.Database()
if err != nil {
app.Logger.Fatal(err)
}
app.Logger.Info("Db connected")
db.AutoMigrate(&models.User{})
db.AutoMigrate(&models.Project{})
defer db.Close()
//console.Schedule()
router.Init(app)
app.Server.Addr = ":8080"
graceful.ListenAndServe(app.Server, 5*time.Second)
}