【发布时间】:2018-02-11 16:28:55
【问题描述】:
我无法让我的 api 调用返回 ubuntu 16.04 上的任何数据。 这是我在 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();
});
这是在 RouteServiceProvider 中:
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
当我点击 localhost/api/cmets 时,我得到 404。
我确保在我的 site.conf 中设置了 AllowOverride All。
我的数据库有一个 cmets 表,其中包含使用工匠种子填充的数据
【问题讨论】:
标签: laravel-5 routes apache2 ubuntu-16.04 restful-architecture