Sha256: d6dc984b01f33b6dbaf0802f36a3657fa884beb984d060f048f716354614b509

Contents?: true

Size: 618 Bytes

Versions: 11

Compression:

Stored size: 618 Bytes

Contents

#!/usr/bin/env ruby
$:<< '../lib' << 'lib'

#
# Example of using "config/conf_test.rb" during server initialization
#  - options parser allows us to extend the command line parameters for API
#  - config file shows loading of environment specific, global, and shared variables
#

require 'goliath'

class ConfTest < Goliath::API
  use Goliath::Rack::Params
  use Goliath::Rack::Render, 'json'

  def options_parser(opts, options)
    options[:test] = 0
    opts.on('-t', '--test NUM', "The test number") { |val| options[:test] = val.to_i }
  end

  def response(env)
    [200, {}, {:response => env.config}]
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
goliath-1.0.7 examples/conf_test.rb
goliath-1.0.6 examples/conf_test.rb
goliath-1.0.5 examples/conf_test.rb
goliath-1.0.4 examples/conf_test.rb
goliath-1.0.3 examples/conf_test.rb
goliath-1.0.2 examples/conf_test.rb
goliath-1.0.1 examples/conf_test.rb
goliath-1.0.0 examples/conf_test.rb
goliath-1.0.0.beta.1 examples/conf_test.rb
goliath-0.9.4 examples/conf_test.rb
goliath-0.9.2 examples/conf_test.rb