Sha256: 5474b0af4d07b3a8f1f96fd15b1987b1f750af5ca5fccf2fcc7d2cd440491235

Contents?: true

Size: 758 Bytes

Versions: 13

Compression:

Stored size: 758 Bytes

Contents

require 'sinatra/base'
require 'tilt/erubis'
require 'json'

require_relative '<%= @gen.wormname %>/racks'
require_relative '<%= @gen.wormname %>/helpers'

module <%= @gen.camelname %>
  class App < Sinatra::Base
    helpers do
      include <%= @gen.camelname %>::Helpers
    end

    get '/' do
      headers 'Vary' => 'Accept'

      respond_to do |wants|
        wants.html do
          @content = '<h1>Hello from <%= @gen.camelname %></h1>'
          @title = '<%= @gen.camelname %>'
          erb :index, layout: :default
        end

        wants.json do
          {
            app: '<%= @gen.camelname %>'
          }.to_json
        end
      end
    end

    # start the server if ruby file executed directly
    run! if app_file == $0
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
skellington-0.7.0 lib/templates/lib/app.rb.eruby
skellington-0.6.2 lib/templates/lib/app.rb.eruby
skellington-0.6.1 lib/templates/lib/app.rb.eruby
skellington-0.5.2 lib/templates/lib/app.rb.eruby
skellington-0.5.1 lib/templates/lib/app.rb.eruby
skellington-0.5.0 lib/templates/lib/app.rb.eruby
skellington-0.4.16 lib/templates/lib/app.rb.eruby
skellington-0.4.15 lib/templates/lib/app.rb.eruby
skellington-0.4.13 lib/templates/lib/app.rb.eruby
skellington-0.4.11 lib/templates/lib/app.rb.eruby
skellington-0.4.10 lib/templates/lib/app.rb.eruby
skellington-0.4.9 lib/templates/lib/app.rb.eruby
skellington-0.4.8 lib/templates/lib/app.rb.eruby