Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :users, only: [:create, :show, :index]
post '/login', to: 'sessions:#create'
delete '/logout', to: 'sessions#destroy'
get '/logged_in', to: 'sessions#is_logged_in?'
# resources :sessions
end
end
end
I’m not sure what’s wrong with my routes. I even tried changing post '/login'
to post '/api/v1/login'
but that didn’t work either. When I commented out the above routed and uncommented resources :sessions
, everything worked fine. Can someone please guide me on the solution?