Sha256: 1eac5136277da2769e70d49fe5067192b7277b244eaa726f788c5b90f1ba6e04

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

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

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

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 %>'
          @github_url = CONFIG['github_url'] || 'https://github.com'
          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

1 entries across 1 versions & 1 rubygems

Version Path
skellington-0.7.2 lib/templates/lib/app.rb.eruby