summaryrefslogtreecommitdiff
path: root/config/routes.rb
blob: bc38e3ff1a93910a5311a3a4a416f88a89538b31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

Rails.application.routes.draw do
  # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

  # Defines the root path route ("/")
  # root "articles#index"
  namespace :api do
    post '/login', to: 'sessions#create'
    delete '/logout', to: 'sessions#destroy'
    get '/account', to: 'user_accounts#show'
    get '/account/addresses', to: 'addresses#index'
    post '/account/addresses', to: 'addresses#create'
    put '/account/addresses/:id', to: 'addresses#update'
    delete '/account/addresses/:id', to: 'addresses#destroy'
    get '/account/cart', to: 'carts#show'
    post '/account/cart', to: 'carts#create'
    delete '/account/cart/:id', to: 'carts#destroy'
    get '/account/cards', to: 'cards#index'
    post '/account/cards', to: 'cards#create'
    put '/account/cards/:id', to: 'cards#update'
    delete '/account/cards/:id', to: 'cards#destroy'
    put '/account', to: 'user_accounts#update'
    resources :orders, only: %i[index show create]
    resources :companies, only: %i[index show create update]
    resources :products, only: %i[index show create update destroy]
    resources :products do
      resources :reviews, only: %i[index create]
    end
    resources :user_accounts, only: %i[create]
    resources :refresh_tokens, only: %i[create]
  end
end