Skip to content

micro/helloworld

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helloworld

Basic helloworld for go-micro.dev/v5 where we remove protobuf requirements

package main

import (
        "context"

        "go-micro.dev/v5"
)

type Say struct {}

type Request struct {
        Name string
}

type Response struct {
        Message string
}

func (s *Say) Hello(ctx context.Context, req *Request, rsp *Response) error {
        rsp.Message = "Hello " + req.Name
        return nil
}

func main() {
        // create service
        service := micro.New("helloworld")
        // register handler
        service.Handle(new(Say))
        // run service
        service.Run()
}

Releases

No releases published

Packages

No packages published

Languages