Skip to content

Instantly share code, notes, and snippets.

@tyabe
Created December 7, 2014 16:33
Show Gist options
  • Save tyabe/21303929625223bd9c2a to your computer and use it in GitHub Desktop.
Save tyabe/21303929625223bd9c2a to your computer and use it in GitHub Desktop.

Revisions

  1. tyabe created this gist Dec 7, 2014.
    4 changes: 4 additions & 0 deletions Gemfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    source "https://rubygems.org"

    gem 'sinatra', require: 'sinatra/base'
    gem 'padrino-cache', require: false
    30 changes: 30 additions & 0 deletions app.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    RACK_ENV = ENV['RACK_ENV'] ||= 'development' unless defined?(RACK_ENV)
    APP_ROOT = File.expand_path('../..', __FILE__) unless defined?(APP_ROOT)

    require 'bundler/setup'
    Bundler.require(:default, RACK_ENV)

    require 'padrino-core'
    Padrino::IGNORE_NO_RENDERING_ENGINE = true
    require 'padrino-cache'

    class App < Sinatra::Base
    register Padrino::Routing
    register Padrino::Cache

    enable :caching
    enable :logging

    set :protect_from_csrf, false

    def logger
    Padrino.logger
    end

    get '/', cache: true do
    expires 10
    Time.now.to_s
    end
    end

    App.run!