title: Rails API - No route matches [POST]
body: <p>I am experimenting the Rails API with devise.
  I am trying to create a POST request so that the user can autenticate using the email and password. To do so, I am using <code>devise</code> and <code>simple token authentication</code></p>
  
  <p>However, when I submit my POST request using postman, I get the error:</p>
  
  <blockquote>
    <p>ActionController::RoutingError (No route matches [POST] "/v1/sessions"):</p>
  </blockquote>
  
  <p>I think the issue is that is sending the post to: <code>/v1/sessions</code> rather than <code>api/v1/sessions</code>.</p>
  
  <p>However, I do not understand why since I declared my routes such as: api-->v1-->sessions</p>
  
  <p><strong>Folder structure of controller</strong></p>
  
  <p><a href="https://i.stack.imgur.com/hH3uZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hH3uZ.png" alt="enter image description here"></a></p>
  
  <p><strong>Routes</strong></p>
  
  <pre><code>Rails.application.routes.draw do
    # devise_for :users
    namespace :api do
      namespace :v1 do
        resources :sessions, only: [:create, :destroy]
      end
    end
  end
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>class V1::SessionsController &lt; ApplicationController
  
    def create
      user = User.where(email: params[:email]).first
      if user&amp;.valid_password?(params[:password])
        render json: user.as_json(only: [:email, :authentication_token]), status: :created
      else
        head(:unauthorized)
      end
    end
  
    def destroy
  
    end
  
  end
  </code></pre>