Files
rynDNS/config/routes.rb
2021-03-07 16:39:38 -05:00

28 lines
1.1 KiB
Ruby

# frozen_string_literal: true
Rails.application.routes.draw do
# TODO: add version namespace (API_VERSION_NAMESPACE - v1)
# allow for subdir deployment, disable format and allow :name to have all ascii symbols except /
scope RynDNS::Application::RELATIVE_URL_ROOT, format: false, constraints: { name: %r{[^/]+} } do
scope '/admin' do
post 'client', to: 'clients#create', format: false
put 'client', to: 'clients#update', format: false
resources :clients, only: %i[index show destroy], param: :name, format: false
end
scope '/client' do
# client (write)
put '', to: 'clients#update_ipv4', format: false
delete '', to: 'clients#destroy_ipv4', format: false
end
scope '/clients' do
# client (read)
get ':name', to: 'clients#show_ipv4', format: false
end
# separate public path to allow for easier segregation and controls via reverse proxy
scope '/public' do
get ':name', to: 'clients#show_public_ipv4', format: false
post ':name', to: 'clients#create_public_ipv4', format: false
end
end
end