-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
42 lines (34 loc) · 855 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
package main
import (
"composable-nfts-service/logging"
"composable-nfts-service/pkg/setting"
"composable-nfts-service/routers"
"fmt"
"github.com/gin-gonic/gin"
"log"
"net/http"
)
func init() {
setting.Setup()
logging.Setup()
}
func main() {
gin.SetMode(setting.ServerSetting.RunMode)
routersInit := routers.InitRouter()
readTimeout := setting.ServerSetting.ReadTimeout
writeTimeout := setting.ServerSetting.WriteTimeout
endPoint := fmt.Sprintf(":%d", setting.ServerSetting.HttpPort)
maxHeaderBytes := 1 << 20
server := &http.Server{
Addr: endPoint,
Handler: routersInit,
ReadTimeout: readTimeout,
WriteTimeout: writeTimeout,
MaxHeaderBytes: maxHeaderBytes,
}
err := server.ListenAndServe()
if err != nil {
logging.Error(err)
}
log.Printf("[info] start http server listening %s", endPoint)
}