This is an example of creating a micro function. A function is a one time executing service.
- main.go - is the main definition of the function
- proto - contains the protobuf definition of the API
Micro services need a discovery system so they can find each other. Micro uses consul by default but its easily swapped out with etcd, kubernetes, or various other systems. We'll run consul for convenience.
Install consul
brew install consulRun Consul
consul agent -devgo get github.com/micro/micro
micro run -r github.com/micro/examples/functionmicro query go.micro.fnc.greeter Greeter.Hello '{"name": "john"}'