samedi 2 septembre 2017

Laravel 5 api route returning 404 apache2

I can't get my api calls to return any data on ubuntu 16.04. Here is my method in routes/api.php:

Route::get('comments', function() {
   // If the Content-Type and Accept headers are set to 'application/json', 
   // this will return a JSON structure. This will be cleaned up later.
   return Comment::all();
});

And this is in RouteServiceProvider:

protected function mapApiRoutes()
    {
        Route::prefix('api')
             ->middleware('api')
             ->namespace($this->namespace)
             ->group(base_path('routes/api.php'));
    }

When i hit localhost/api/comments I get 404.

I made sure AllowOverride All is set in my site.conf.

My database has a comments table with data that was populated using artisan seed



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire