Sha256: 4d78b5d35913fe8e533a6e50a5abb9fec98d6d6012dddc4d796adb6825e2106a

Contents?: true

Size: 1.74 KB

Versions: 17

Compression:

Stored size: 1.74 KB

Contents

require 'sidekiq/web'

DiscoApp::Engine.routes.draw do

  get 'ref', to: '/sessions#referral'
  get '/auth/failure', to: '/sessions#failure'

  controller :webhooks do
    post 'webhooks' => :process_webhook, as: :webhooks
  end

  resources :user_sessions, only: [:new, :create, :destroy]
  get 'auth/shopify_user/callback' => 'user_sessions#callback'

  resources :subscriptions, only: [:new, :create] do
    resources :charges, only: [:new, :create] do
      member do
        get 'activate'
      end
    end
  end

  controller :install do
    get 'install' => :install, as: :install
    get 'installing' => :installing, as: :installing
    get 'uninstalling' => :uninstalling, as: :uninstalling
  end

  controller 'admin' do
    get 'admin', to: redirect('/admin/shops')
    get 'admin/shops' => 'admin/shops#index'
  end

  namespace :admin do
    resources :shops, only: [:index, :edit, :update] do
      resources :subscriptions, only: [:edit, :update]
    end
    resources :plans
    resources :sources
    resource :app_settings, only: [:edit, :update]

    # JSON-API resources for admins.
    namespace :resources do
      jsonapi_resources :shops
    end
  end

  # Make the Sidekiq Web UI accessible using the same credentials as the admin.
  if Rails.env.production?
    Sidekiq::Web.use Rack::Auth::Basic do |username, password|
      [
        ENV['ADMIN_APP_USERNAME'].present?,
        ENV['ADMIN_APP_USERNAME'] == username,
        ENV['ADMIN_APP_PASSWORD'].present?,
        ENV['ADMIN_APP_PASSWORD'] == password,
      ].all?
    end
    mount Sidekiq::Web, at: '/sidekiq'
  end

  # Make the embedded app frame emulator available in development.
  if Rails.env.development?
    controller :frame do
      get 'frame' => :frame, as: :frame
    end
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
disco_app-0.13.0 config/routes.rb
disco_app-0.13.1 config/routes.rb
disco_app-0.13.2 config/routes.rb
disco_app-0.13.3 config/routes.rb
disco_app-0.13.4 config/routes.rb
disco_app-0.13.5 config/routes.rb
disco_app-0.13.6 config/routes.rb
disco_app-0.13.7 config/routes.rb
disco_app-0.13.8 config/routes.rb
disco_app-0.14.1 config/routes.rb
disco_app-0.14.2 config/routes.rb
disco_app-0.15.0 config/routes.rb
disco_app-0.14.4 config/routes.rb
disco_app-0.14.3 config/routes.rb
disco_app-0.15.2 config/routes.rb
disco_app-0.14.0 config/routes.rb
disco_app-0.13.6.pre.puma.pre.3 config/routes.rb