Sha256: 828ac9ac9ddd20bbafe167675531f71352d4e8e425d0260bcc9d5fe1d5506350

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'cotton_tail'

app = CottonTail::App.new

app.config.middleware do |_b|
  # This is added to the end of the middleware stack
  # 'message' is the return value of the handlers defined below
  d.use ->(message) { puts message.upcase }
end

app.routes.draw do
  queue 'hello_world_queue', exclusive: true do
    handle 'say.hello' do
      'Hello world!'
    end

    handle 'say.goodbye' do
      'Goodbye cruel world!'
    end
  end
end

app.start

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cotton-tail-0.3.0 examples/app_with_middleware.rb