Rails.application.routes.draw do

  root "dashboard#index"
  get "/auth/auth0/callback" => "auth0#callback"
  get "/auth/failure" => "auth0#failure"
  get   '/login', :to => 'sessions#new', :as => :login
  get   '/logout', :to => 'sessions#destroy', :as => :logout

  resources :timeslots, only: [:update, :show, :destroy]

  namespace :api, defaults: {format: :json} do
    resources :timeslots, only: [:index, :create, :update]
  end
end

Rails.application.routes.draw do

  root "dashboard#index"
  get "/auth/auth0/callback" => "auth0#callback"
  get "/auth/failure" => "auth0#failure"
  get   '/login', to: 'sessions#new', as: :login
  get   '/logout', to: 'sessions#destroy', as: :logout

  resources :timeslots, only: [:update, :show, :destroy]

  namespace :api, defaults: {format: :json} do
    patch 'timeslots/:id/cancel', to: 'timeslots#cancel', as: :cancel
    resources :timeslots, only: [:index, :create, :update]
  end
end

Add named route for canceling a scheduled session
Add named route for canceling a scheduled session

Add route api/timeslots/:id/cancel to allow either the tutor or student
to cancel a previously scheduled session.
