Rails.application.routes.draw do # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. # Can be used by load balancers and uptime monitors to verify that the app is live. # get "up" => "rails/health#show", as: :rails_health_check get "admin", to: redirect("/admin/en") namespace :admin do scope ":locale", constraints: { locale: /en|zh|hr|cs|da|nl|fi|fr|fr-CA|de|hu|it|ja|ko|nb|pl|pt|ro|sr|sk|sl|es|sv|uk/ } do # Assets resources :assets do collection do post :upload end end # Nodes resources :nodes do member do get :children get :tree end collection do get :tree patch :sort patch :toggle end resources :assets, only: [ :index ] resources :attachments, only: [ :new ] end # Users resources :users # Root root to: "nodes#index" end # Cache delete "cache/clear", to: "admin#clear_cache" resources :sessions, path: "login", only: [ :index, :create, :destroy ] get "logout", to: "sessions#destroy", as: "logout" # 2 step auth post "login/verify", to: "sessions#verify" get "login/verification", to: "sessions#verification" end scope ":locale", constraints: { locale: /en|zh|hr|cs|da|nl|fi|fr|fr-CA|de|hu|it|ja|ko|nb|pl|pt|ro|sr|sk|sl|es|sv|uk/ } do post "start", to: "players#create", as: "start" scope "stages/:id", constraints: { id: /\d+/ } do get "", to: "stages#show", as: "stage" post "flip", to: "stages#flip" get "reveal", to: "stages#reveal" post "pick(/:option)", to: "stages#pick" get "result", to: "stages#result" end get "", to: "languages#show" # get "*url", to: "site#page", constraints: lambda { |req| req.path.exclude?("storage") } end put "update_locale", to: "languages#update" # Defines the root path route ("/") root "languages#index" end