title: Laravel 5.4 API route
body: <p>My web routes are working, however I cannot POST to my api routes, I receive <code>MethodNotAllowedHttpException</code>. I think this is a csrf token problem as GET works, but I can't figure out how to fix it. I am using Postman to simulate api requests.</p>
  
  <p>auth.php</p>
  
  <pre><code>'guards' =&gt; [
      'web' =&gt; [
          'driver' =&gt; 'session',
          'provider' =&gt; 'users',
      ],
  
      'api' =&gt; [
          'driver' =&gt; 'token',
          'provider' =&gt; 'devices',
      ],
  ],
  </code></pre>
  
  <p>RouteServiceProvider.php</p>
  
  <pre><code>protected function mapApiRoutes()
  {
      Route::middleware('api')
           -&gt;namespace($this-&gt;namespace)
           -&gt;group(base_path('routes/api.php'));
  }
  </code></pre>
  
  <p>routes/api.php</p>
  
  <pre><code>Route::post('api', ['uses' =&gt; 'DeviceController@api']);
  </code></pre>
  
  <p>kernel.php</p>
  
  <pre><code>protected $middlewareGroups = [
      'web' =&gt; [
          \App\Http\Middleware\EncryptCookies::class,
          \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
          \Illuminate\Session\Middleware\StartSession::class,
          // \Illuminate\Session\Middleware\AuthenticateSession::class,
          \Illuminate\View\Middleware\ShareErrorsFromSession::class,
          \App\Http\Middleware\VerifyCsrfToken::class,
          \Illuminate\Routing\Middleware\SubstituteBindings::class,
      ],
  
      'api' =&gt; [
          'throttle:60,1',
          'auth:api',
          'bindings',
      ],
  ];
  </code></pre>
  
  <p>This is an upgrade from an older version of Laravel that was working, I upgraded by installing a fresh copy of Laravel 5.4 then copied over my code, changing it as needed.</p>