-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (29 loc) · 748 Bytes
/
main.go
File metadata and controls
34 lines (29 loc) · 748 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
package main
import (
"log"
"github.com/question-service/api"
"github.com/question-service/backend"
"github.com/question-service/config"
"github.com/question-service/logic"
)
func main() {
conf := config.NewConfig()
b := makeBackend(conf)
l := makeLogic(conf, b)
s := api.NewServer(conf, l)
log.Fatal(s.ListenAndServe())
}
func makeBackend(conf config.Config) backend.Backend {
b, err := backend.NewBackend(conf)
if err != nil {
log.Fatalf("error: backend layer could not be created (%+v)\n", err)
}
return b
}
func makeLogic(conf config.Config, backend backend.Backend) logic.Logic {
l, err := logic.NewLogic(conf, backend)
if err != nil {
log.Fatalf("error: logic layer could not be created (%+v)\n", err)
}
return l
}