-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (34 loc) · 772 Bytes
/
main.go
File metadata and controls
44 lines (34 loc) · 772 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
38
39
40
41
42
43
44
package main
import (
"github.com/IoThingsDev/api/server"
"github.com/IoThingsDev/api/services"
"github.com/spf13/viper"
"gopkg.in/gin-gonic/gin.v1"
)
func main() {
api := &server.API{Router: gin.Default(), Config: viper.New()}
// Configuration setup
err := api.SetupViper()
if err != nil {
panic(err)
}
// Email sender setup
api.EmailSender = services.NewSendGridEmailSender(api.Config)
// Database setup
session, err := api.SetupDatabase()
if err != nil {
panic(err)
}
defer session.Close()
err = api.SetupIndexes()
if err != nil {
panic(err)
}
// Stripe setup
//services.SetStripeKeyAndBackend(api.Config)
// Redis setup
api.SetupRedis()
// Router setup
api.SetupRouter()
api.Router.Run(api.Config.GetString("host_address"))
}