title: Laravel API: The POST method is not supported for this route. Supported methods: GET, HEAD
body: <p>I am sending a post request to <code>http://localhost/projects/webdevlist/public/api/register</code> and getting the 405 error:</p>
  
  <pre><code>Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
  The POST method is not supported for this route. Supported methods: GET, HEAD.
  </code></pre>
  
  <p>routes\api.php:</p>
  
  <pre><code>&lt;?php
  
  use Illuminate\Http\Request;
  
  Route::middleware('auth:api')-&gt;get('/user', function (Request $request) {
      return $request-&gt;user();
  });
  
  Route::post('/register', 'Api\AuthController@register');
  </code></pre>
  
  <p>Api\AuthController.php:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers\Api;
  
  use App\User;
  use App\Http\Controllers\Controller;
  use Illuminate\Http\Request;
  
  class AuthController extends Controller
  {
      public function register(Request $request)
      {
          $validatedData = $request-&gt;validate([
              'name' =&gt; 'required|max:55',
              'email' =&gt; 'required|email',
              'password' =&gt; 'required|confirmed'
          ]);
  
          $user = User::create($validatedData);
  
          $accessToken = $user-&gt;createToken('token')-&gt;accessToken;
  
          return response(['user' =&gt; $user, 'access_token' =&gt; $accessToken]);
      }
  }
  </code></pre>
  
  <p>If I remove the form validation then I can do post requests just fine and return a result in postman like this. </p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers\Api;
  
  use App\User;
  use App\Http\Controllers\Controller;
  use Illuminate\Http\Request;
  
  class AuthController extends Controller
  {
      public function register(Request $request)
      {
          return response()-&gt;json([
              $request-&gt;name,
              $request-&gt;email,
              $request-&gt;password,
          ]);
      }
  }
  </code></pre>
  
  <p>But something is wrong with my validation. Why does the validation cause me to no longer be able to accept <code>POST</code> requests?</p>
  
  <p>Here is my POST request:
  <a href="https://i.stack.imgur.com/LGiCo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LGiCo.png" alt="enter image description here"></a></p>