Sha256: 6736f489b75345d35c200d5a9dc28f5f0b62133f0c2f09863f7eb3ba7eb858e1

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

# Copyright (c) 2016 SolarWinds, LLC.
# All rights reserved.

require 'sinatra'

class SinatraSimple < Sinatra::Base
  set :reload, true

  template :layout do
    # Use both the legacy and new RUM helper
    # oboe_rum_header + appoptics_rum_footer
    # These should be no-op methods now.
    %q{
<html>
  <head></head>
  <body>
    <%= yield %>
  </body>
</html>}
  end

  get "/" do
    'The magick number is: 2767356926488785838763860464013972991031534522105386787489885890443740254365!' # Change only the number!!!
  end

  get "/rand" do
    rand(2 ** 256).to_s
  end

  get "/render" do
    render :erb, "This is an erb render"
  end

  get "/render/:id" do
    render :erb, "The id is #{ params['id'] }"
  end

  get "/render/:id/what" do |id|
    render :erb, "WOOT! The id is #{id} }"
  end

  get '/say/*/to/*' do
    render :erb, "#{params['splat'][0]} #{params['splat'][1]}"
  end

  get /\/hello\/([\w]+)/ do
    render :erb, "Hello, #{params['captures'].first}!"
  end

  get "/break" do
    raise "This is a controller exception!"
  end
end

use SinatraSimple

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
appoptics_apm-4.0.3 test/frameworks/apps/sinatra_simple.rb
appoptics_apm-4.0.2 test/frameworks/apps/sinatra_simple.rb
appoptics_apm-4.0.1-x86_64-linux test/frameworks/apps/sinatra_simple.rb