Sha256: 91ef217fc850bfb8d22a70fda49b4812387a94633bcc68fc5853cd31b5358154

Contents?: true

Size: 889 Bytes

Versions: 2

Compression:

Stored size: 889 Bytes

Contents

require_relative "lib/easycomments.rb"
require_relative "lib/easycomments/ec_model.rb"

class EC < Sinatra::Application

  include ECModel

  before do
    content_type 'application/json'
  end

  if ALLOW_CORS
    use Rack::Cors do
      allow do
        origins CORS_ORIGIN
        resource '/comments', :headers => :any, :methods => :get
        resource '/comment', :headers => :any, :methods => :post
      end
    end
    use Rack::Protection::FrameOptions
    use Rack::Protection::PathTraversal
    use Rack::Protection::IPSpoofing
  else
    use Rack::Protection::FrameOptions
    use Rack::Protection::PathTraversal
    use Rack::Protection::IPSpoofing  
    use Rack::Protection::HttpOrigin
  end


  get "/comments" do
    get_comments(params[:post], params[:page])
  end

  post "/comment" do
    post_comment(params)
  end

  get "/" do
    redirect "/dashboard"
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easycomments-1.0.5 ec.rb
easycomments-1.0.4 ec.rb