Sha256: 9388b8ad1a4eb03b657546d8f617bcc15345181534f3b7f2e5e117a414603aa1

Contents?: true

Size: 548 Bytes

Versions: 3

Compression:

Stored size: 548 Bytes

Contents

module Spontaneous::Rack::Back
  class Site < Base
    SS = Spontaneous::Site

    get '/?' do
      json({
        :types => SS.schema.export(user),
        :roots => SS.roots(user, content_model),
        :user  => user.export,
        :services => (SS.config.services || [])
      })
    end

    get '/home' do
      json SS.root
    end

    post '/home' do
      forbidden! unless SS.root.nil?
      type = content_model.schema.to_class(params[:type])
      root = type.create(:title => "Home")
      json({:id => root.id})
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta4 lib/spontaneous/rack/back/site.rb
spontaneous-0.2.0.beta3 lib/spontaneous/rack/back/site.rb
spontaneous-0.2.0.beta2 lib/spontaneous/rack/back/site.rb