-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (35 loc) · 852 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
package main
import (
"notification-service/internal/api"
"notification-service/internal/client"
"notification-service/internal/config"
"notification-service/internal/util"
)
func main() {
// Initializations
config.InitConfigs()
client.InitClients()
// Handlers
var (
hasHTTPHandler = false
fiberApp = api.NewFiberApp()
)
// HTTP REST API V1
if config.Master.Service.APIs.Has(config.HTTP_REST_V1_API) {
hasHTTPHandler = true
api.SetUpRESTV1(fiberApp)
}
// RabbitMQ API V1
if config.Master.Service.APIs.Has(config.RABBITMQ_V1_API) {
api.SetUpRabbitMQV1()
}
// Starting HTTP server
if hasHTTPHandler {
util.Logger.Info().Msg("HTTP Server is ON")
err := fiberApp.Listen(config.Master.HTTP.Address)
if err != nil {
util.Logger.Error().Msg(err.Error())
util.Logger.Panic().Msg("HTTP Server failed!")
}
}
}