first commit

This commit is contained in:
2026-02-13 15:57:28 +07:00
parent d4248b62e1
commit 7ae8c76a20
26 changed files with 5040 additions and 32 deletions
+26
View File
@@ -0,0 +1,26 @@
package server
import (
"fmt"
"log"
"net"
"api-service/internal/config"
"api-service/internal/grpc/pb"
pasienHandlers "api-service/internal/handlers/pasien"
"google.golang.org/grpc"
)
func RunGRPCServer(cfg *config.Config, pasienHandler *pasienHandlers.PasienHandler) error {
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", cfg.GRPC.Port))
if err != nil {
return err
}
s := grpc.NewServer()
pb.RegisterPasienServiceServer(s, NewPasienGRPCServer(pasienHandler))
log.Printf("gRPC server listening on :%d", cfg.GRPC.Port)
return s.Serve(lis)
}