Skip to content

aofengli/examples

 
 

Repository files navigation

Micro Examples Travis CI Go Report Card

This is a repository for micro examples. Feel free to contribute.

Contents

  • api - Provides API usage examples
  • booking - A booking.com demo application
  • broker - A example of using Broker for Publish and Subscribing.
  • client - Usage of the Client package to call a service.
  • command - An example of bot commands as micro services
  • config - Using Go Config for dynamic config
  • event - Using the API Gateway event handler
  • flags - Using command line flags with a service
  • form - How to parse a form behind the micro api
  • function - Example of using Function programming model
  • graceful - Demonstrates graceful shutdown of a service
  • greeter - A complete greeter example (includes python, ruby examples)
  • heartbeat - Make services heartbeat with discovery for high availability
  • helloworld - Hello world using micro
  • metadata - Extracting metadata from context of a request
  • mocking - Demonstrate mocking helloworld service
  • noproto - Use micro without protobuf or code generation, only go types
  • options - Setting options in the go-micro framework
  • plugins - How to use plugins
  • pubsub - Example of using pubsub at the client/server level
  • grpc - Examples of how to use go-grpc
  • redirect - An example of how to http redirect using an API service
  • roundrobin - A stateful client wrapper for true round robin of requests
  • secure - Demonstrates use of transport secure option for self signed certs
  • server - Use of the Server package directly to server requests.
  • service - Example of the top level Service in go-micro.
  • sharding - An example of how to shard requests or use session affinity
  • shutdown - Demonstrates graceful shutdown via context cancellation
  • stream - An example of a streaming service and client
  • template - Api, web and srv service templates generated with the 'micro new' command
  • waitgroup - Demonstrates how to use a waitgroup with a service
  • wrapper - A simple example of using a log wrapper

Community

Find contributions from the community via the explorer

  • go-shopping - A sample product with a suite of services
  • shippy - A multi app demo and tutorial

Dependencies

Service Discovery

All services require service discovery. The default is Consul or MDNS.

Consul

Install

brew install consul

Run

consul agent -dev

Multicast DNS

Use flag --registry=mdns for a zero dependency configuration

Protobuf

Protobuf is used for code generation of message types and client/hander stubs.

If making changes recompile the protos.

Install

Install protoc for your environment. Then:

go get github.com/golang/protobuf/{proto,protoc-gen-go}
go get github.com/micro/protoc-gen-micro

Compile Proto

protoc --proto_path=$GOPATH/src:. --micro_out=. --go_out=. path/to/proto

About

How-to examples of micro

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 84.5%
  • Ruby 4.8%
  • Python 4.2%
  • HTML 3.4%
  • JavaScript 1.5%
  • Makefile 1.2%
  • Shell 0.4%