Freddie

Yet another web application framework for Ruby. :)

Example

run Freddie do
  layout 'application.html.haml'

  # Serve some asset files
  #
  path('application-:timestamp.css') { stylesheet 'application.scss' }
  path('application-:timestamp.js')  { javascript 'application.js' }

  # Built-in OmniAuth support
  #
  omni_auth

  # Provide a /logout action
  #
  path('logout') do
    session['omniauth_user'] = nil
    redirect_to '/'
  end

  # Mount a RESTful resource. This adds all the required
  # paths and even applies authorization scopes for the
  # currently logged in user.
  #
  resource :events do
    can :index, :show
    can :new, :create, :update, :destroy if current_user.admin?
  end

  # The root action is a simple redirect.
  #
  redirect_to '/events'
end