Skip to content

Commit 0420d5c

Browse files
committed
re-structure routes
1 parent 13ef25e commit 0420d5c

5 files changed

Lines changed: 39 additions & 22 deletions

File tree

config/routes.rb

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,14 @@
11
# frozen_string_literal: true
22

33
Rails.application.routes.draw do
4-
devise_for :users, controllers: {
5-
omniauth_callbacks: "users/omniauth_callbacks",
6-
sessions: "users/sessions"
7-
}
8-
# Redirect to localhost from 127.0.0.1 to use same IP address with Vite server
9-
constraints(host: "127.0.0.1") do
10-
get "(*path)", to: redirect { |params, req| "#{req.protocol}localhost:#{req.port}/#{params[:path]}" }
11-
end
12-
root "inertia_example#index"
13-
get "inertia-example", to: "inertia_example#index"
4+
draw :public
145

15-
resources :items
6+
# Demo inertia
7+
draw :demo
168

17-
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
9+
# Authentication
10+
draw :devise
1811

19-
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
20-
# Can be used by load balancers and uptime monitors to verify that the app is live.
21-
get "up" => "rails/health#show", as: :rails_health_check
22-
23-
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
24-
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
25-
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
26-
27-
# Defines the root path route ("/")
28-
# root "posts#index"
12+
# Demo CRUD
13+
draw :items
2914
end

config/routes/demo.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# frozen_string_literal: true
2+
3+
root "inertia_example#index"
4+
get "inertia-example", to: "inertia_example#index"

config/routes/devise.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
devise_for :users, controllers: {
4+
omniauth_callbacks: "users/omniauth_callbacks",
5+
sessions: "users/sessions"
6+
}

config/routes/items.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# frozen_string_literal: true
2+
3+
resources :items

config/routes/public.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
# Redirect to localhost from 127.0.0.1 to use same IP address with Vite server
4+
constraints(host: "127.0.0.1") do
5+
get "(*path)", to: redirect { |params, req| "#{req.protocol}localhost:#{req.port}/#{params[:path]}" }
6+
end
7+
8+
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
9+
10+
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
11+
# Can be used by load balancers and uptime monitors to verify that the app is live.
12+
get "up" => "rails/health#show", as: :rails_health_check
13+
14+
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
15+
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
16+
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
17+
18+
# Defines the root path route ("/")
19+
# root "posts#index"

0 commit comments

Comments
 (0)