Brijesh's Git Server — trying-grpc @ 7cf3ce98e6bd56af5f66a0807211d2e021d295ca

Trying to use GRPC in go using twitchs twirp packge

cmd/server/main.go (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
package main

import (
	"fmt"
	"net/http"

	"github.com/wbrijesh/trying-trpc/internal/haberdasherserver"
	"github.com/wbrijesh/trying-trpc/rpc/haberdasher"
)

func main() {
	server := &haberdasherserver.Server{} // implements Haberdasher interface
	twirpHandler := haberdasher.NewHaberdasherServer(server)

	err := http.ListenAndServe(":8080", twirpHandler)
	if err != nil {
		fmt.Println("Error starting server: ", err)
		return
	}
}