-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
43 lines (33 loc) · 766 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 (
"app/pkg/service/router"
"app/settings"
"fmt"
"log"
"net/http"
"github.com/joho/godotenv"
_ "github.com/mattn/go-sqlite3"
)
func init() {
var error error
if error = godotenv.Load(); error != nil {
log.Fatal(error)
}
settings.Setup()
}
func main() {
//create_database()
//test()
routersInit := router.InitRouter()
readTimeout := settings.ServerSetting.ReadTimeout
writeTimeout := settings.ServerSetting.WriteTimeout
port := settings.ApiSetting.ServerPort
server := &http.Server{
Addr: fmt.Sprintf(":%s", port),
Handler: routersInit,
ReadTimeout: readTimeout,
WriteTimeout: writeTimeout,
}
log.Default().Printf("[info] Server running on http://localhost:%s", port)
server.ListenAndServe()
}