-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
36 lines (28 loc) · 873 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
package main
import (
"log"
"net"
app "github.com/isaqueveraslabs/customer-microservice/application/customer"
config "github.com/isaqueveraslabs/customer-microservice/configuration"
inter "github.com/isaqueveraslabs/customer-microservice/interfaces/customer"
gogrpc "google.golang.org/grpc"
)
func main() {
// Loading config of system
config.Load()
// Listen on port
listen, err := net.Listen("tcp", config.Get().Address)
if err != nil {
log.Fatalf("Failed to listen: %v", err.Error())
}
// Creating new server
server := gogrpc.NewServer()
// customer registration server
app.RegisterCustomerServer(server, &inter.Server{})
// Message of success
log.Println(config.Get().Name, "is running in port", config.Get().Address)
// Initializing server
if err = server.Serve(listen); err != nil {
log.Fatalf("Failed to server: %v", err.Error())
}
}