title: Laravel API Not Found
body: <p>I'm trying to test my api and for this matter I don't need authentication for my api all I want to do is to share my published posts with api but I get <code>404</code> page.</p>
  
  <h1>Code</h1>
  
  <p><code>controller</code></p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers\API;
  
  use Illuminate\Http\Request;
  use App\Http\Controllers\Controller;
  use App\Post;
  
  class PostController extends Controller
  {
      public function index(){
          return Post::orderby('id', 'desc')-&gt;where('status', '=', '1')-&gt;get();
      }
  
      public function single($slug){
          return Post::where('slug', $slug)-&gt;where('status', '=', '1')-&gt;firstOrFail();
      }
  }
  </code></pre>
  
  <p><code>api.php</code> (routes folder)</p>
  
  <pre><code>Route::get('posts', 'API\PostController@index');
  Route::get('posts/{slug}', 'API\PostController@single');
  </code></pre>
  
  <p>I tried to access my api posts with url like:  <code>http://newapp.test/api/posts</code> and it returns <code>404</code> error.</p>
  
  <p><strong>Any idea?</strong></p>
  
  <h1>Update</h1>
  
  <p><code>api.php</code></p>
  
  <pre><code>&lt;?php
  
  use Illuminate\Http\Request;
  
  // Route::middleware('auth:api')-&gt;get('/user', function (Request $request) {
  //     return $request-&gt;user();
  // });
  
  Route::get('posts', 'API\PostController@index');
  Route::get('posts/{slug}', 'API\PostController@single');
  </code></pre>