README.md in micro-rb-0.1.0.rc1 vs README.md in micro-rb-0.1.0.rc2

- old
+ new

@@ -1,20 +1,14 @@ -[![Build Status](https://travis-ci.org/amedeiros/micro-rb.svg?branch=master)](https://travis-ci.org/amedeiros/micro-rb) +[![Build Status](https://travis-ci.org/amedeiros/micro-rb.svg?branch=master)](https://travis-ci.org/amedeiros/micro-rb) [![Gem Version](https://badge.fury.io/rb/micro-rb.svg)](https://badge.fury.io/rb/micro-rb) # MicroRb MicroRb allows you to develop micro services for the [micro](https://github.com/micro/micro) framework. MicroRb uses the [sidecar](https://github.com/micro/micro/tree/master/car) that comes with micro. If you want to write services in Go see [go-micro](https://github.com/micro/go-micro) or in java see [ja-micro](https://github.com/Sixt/ja-micro). ## Installation -Currently not on rubygems install with bundler and git - -```ruby -gem 'micro-rb', github: 'amedeiros/micro-rb' -```` - Add this line to your application's Gemfile: ```ruby gem 'micro-rb' ``` @@ -23,11 +17,11 @@ $ bundle Or install it yourself as: - $ gem install micro-rb + $ gem install micro-rb -v '0.1.0.rc2' ## Status Currently in development. If I can get some pull requests that would be much appreciated. @@ -85,18 +79,29 @@ `Port: 8081` `Registy: "/registry"` +Configuration has the following defaults for api gateway. +`Host: http://127.0.0.1` + +`Port: 3002` + +`Rpc: "/rpc"` + Configuration can be changed. ```ruby MicroRb::Configuration.configure do |c| c.sidecar_host = 'http://mysite.com' c.sidecar_port = '8080' c.sidecar_registry = '/awesome_registry' + + c.gateway_host = 'http://mysite.com' + c.gateway_port = '8080' + c.gateway_rpc = '/awesome_micro_rb' end ``` Want to run puma? No problem just add puma to your Gemfile and require the rack handler and tell the web server to use puma. This works with thin etc because we just pass the options along to the rack server. Try it with the sum example! @@ -135,10 +140,18 @@ { "total": 3 } ``` +```ruby +result = MicroRb::Clients::Rpc.call(service: 'test', method: 'MyHandler.sum', params: {a:1, b:2}) +ap result +{ + "total" => 3 +} +``` + ## Calling the service directly ``` $ http POST 0.0.0.0:3000 service=test method=MyHandler.sum id=1 params:='[{"a": 1, "b": 2}]' HTTP/1.1 200 OK @@ -146,9 +159,22 @@ Content-Length: 31 Date: Tue, 09 May 2017 18:08:25 GMT Server: WEBrick/1.3.1 (Ruby/2.4.0/2016-12-24) {"result":{"total":3},"id":"1"} +``` + + +```ruby +result = MicroRb::Clients::Http.call(uri: 'http://0.0.0.0:3000', service: 'test', method: 'MyHandler.sum', params: {a:1, b:2}) +ap result + +{ + "result" => { + "total" => 3 + }, + "id" => nil +} ``` ## Project Generator ```