devise icon indicating copy to clipboard operation
devise copied to clipboard

Way to remove useless endpoints in API mode

Open pupeno opened this issue 5 years ago • 2 comments

I think it would be cool if Devise could have endpoints be in API mode and in those cases all the endpoints that just show a form should not be present. Those routes make no sense for an API. For example, most of these:

#                      new_user_session GET    /api/v1/users/sign_in(.:format)                                                          devise/sessions#new {:format=>:json}
#                     new_user_password GET    /api/v1/users/password/new(.:format)                                                     devise/passwords#new {:format=>:json}
#                    edit_user_password GET    /api/v1/users/password/edit(.:format)                                                    devise/passwords#edit {:format=>:json}
#              cancel_user_registration GET    /api/v1/users/cancel(.:format)                                                           devise/registrations#cancel {:format=>:json}
#                 new_user_registration GET    /api/v1/users/sign_up(.:format)                                                          devise/registrations#new {:format=>:json}
#                edit_user_registration GET    /api/v1/users/edit(.:format)                                                             devise/registrations#edit {:format=>:json}
#                 new_user_confirmation GET    /api/v1/users/confirmation/new(.:format)                                                 devise/confirmations#new {:format=>:json}
#                     user_confirmation GET    /api/v1/users/confirmation(.:format)                                                     devise/confirmations#show {:format=>:json}
#                       new_user_unlock GET    /api/v1/users/unlock/new(.:format)                                                       devise/unlocks#new {:format=>:json}
#                           user_unlock GET    /api/v1/users/unlock(.:format)                                                           devise/unlocks#show {:format=>:json}

pupeno avatar May 20 '20 19:05 pupeno

This makes sense. Could you please provide a PR?

rafaelfranca avatar May 20 '20 23:05 rafaelfranca

I can provide this PR soon, this is a nice feature