Sha256: 960a3d93406c9e594452d10e8b4e38b010777fc01b11cee896ffc35ab5c2fc64

Contents?: true

Size: 540 Bytes

Versions: 2

Compression:

Stored size: 540 Bytes

Contents

# coding: utf-8
# frozen_string_literal: true

require_relative '../../../lib/microrb'
require_relative '../examples/proto/sum_pb'

class MyHandler
  include MicroRb::Handler
  include MicroRb::SumHandler

  handler name: :test, metadata: { hello: 'Micro-Rb' }, rpc_method: :sum

  def sum(request: Request.new, response: Response.new)
    response.total = request.a + request.b

    response
  end
end

server = MicroRb::Servers::Web.new(:test, debug: true, metadata: { example: 'Service' })
server.add_handler MyHandler.new
server.start!

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
micro-rb-0.1.0.rc2 lib/micro/examples/sum.rb
micro-rb-0.1.0.rc1 lib/micro/examples/sum.rb