README.md in micro-rb-0.1.0.rc2 vs README.md in micro-rb-0.1.0.rc3
- old
+ new
@@ -65,12 +65,14 @@
response
end
end
-server = MicroRb::Servers::Web.new(:test, debug: true)
-server.add_handler MyHandler.new
+service_config = MicroRb::ServiceConfiguration.new(name: :test)
+service_config.add_handler(MyHandler.new)
+
+server = MicroRb::Servers::Web.new(service_config)
server.start!
```
Configuration has the following defaults for sidecar endpoint.
@@ -79,11 +81,11 @@
`Port: 8081`
`Registy: "/registry"`
-Configuration has the following defaults for api gateway.
+Configuration has the following defaults for the micro api.
`Host: http://127.0.0.1`
`Port: 3002`
@@ -95,22 +97,23 @@
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'
+ c.api_host = 'http://mysite.com'
+ c.api_port = '8080'
+ c.api_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!
```ruby
require 'rack/handler/puma'
-server = MicroRb::Servers::Web.new(:test, debug: true, server: :puma)
+service_config = MicroRb::ServiceConfiguration.new(name: :test, server: :puma)
+server = MicroRb::Servers::Web.new(service_config)
```
Every handler must setup the following requirements at a minimum.
`handler name: :my_name, rpc_method: :some_method`
@@ -121,10 +124,10 @@
![alt text](https://github.com/amedeiros/micro-rb/blob/master/registry.png)
![alt text](https://github.com/amedeiros/micro-rb/blob/master/sum.png)
-## Micro API Gateway
+## Micro API
`micro api --address 0.0.0.0:3002`
```
$ http POST 0.0.0.0:3002/rpc method=MyHandler.sum service=test request='{"a": 1, "b": 2}'