-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (29 loc) · 661 Bytes
/
main.go
File metadata and controls
37 lines (29 loc) · 661 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
37
package main
import (
"fmt"
"golang-auth/configs"
"golang-auth/db"
"golang-auth/routes"
"github.com/ilyakaznacheev/cleanenv"
"github.com/labstack/echo/v4"
)
var e = echo.New()
func init() {
//Initialize the cleanenv package
err := cleanenv.ReadEnv(&configs.Cfg)
fmt.Printf("%v", configs.Cfg)
if err != nil {
e.Logger.Fatal("Unable to load configuration")
}
//Setup database connection
cl, err := db.ConnectDB()
if err != nil {
e.Logger.Fatal("Unable to connect to database")
}
//Set up the routes
routes.InitRoutes(e, cl)
}
func main() {
//Start the server
e.Logger.Fatal(e.Start(fmt.Sprintf("localhost:%s", configs.Cfg.Port)))
}