-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
38 lines (33 loc) · 876 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
package main
import (
"context"
"github.com/gin-gonic/gin"
"github.com/go-leo/gors"
"github.com/go-leo/gors/example/api/tests/additional_bindings"
"net"
"net/http"
)
func main() {
engine := gin.New()
engine = gors.AppendRoutes(engine, additional_bindings.MessagingServiceRoutes(NewMessagingService())...)
srv := http.Server{Handler: engine}
listen, err := net.Listen("tcp", ":8088")
if err != nil {
panic(err)
}
err = srv.Serve(listen)
if err != nil {
panic(err)
}
}
type MessagingService struct {
}
func (m MessagingService) UpdateMessage(ctx context.Context, message *additional_bindings.Message) (*additional_bindings.Message, error) {
return &additional_bindings.Message{
MessageId: message.GetMessageId(),
Text: message.GetText(),
}, nil
}
func NewMessagingService() additional_bindings.MessagingService {
return &MessagingService{}
}