1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-12 08:23:58 +02:00
go-micro/examples/service
2016-01-02 23:15:57 +00:00
..
proto Update top level init 2016-01-01 01:16:21 +00:00
wrapper Example of how to use wrappers with top level service 2016-01-02 22:32:23 +00:00
main.go update client 2016-01-02 23:15:57 +00:00
README.md Update top level init 2016-01-01 01:16:21 +00:00

Service

This is an example of creating a micro service using the top level interface.

Prereqs

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.

  1. Follow the install instructions - https://www.consul.io/intro/getting-started/install.html

  2. Run Consul

$ consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul

Run the example

  1. Get the service
go get github.com/micro/go-micro/examples/service
  1. Run the server
$GOPATH/bin/service
  1. Run the client
$GOPATH/bin/service --client

And that's all there is to it.