I am trying to test out an API route in Laravel, however, I'm feeling like I haven't really configured my server as Laravel intends! In short, I'm working with the following folder structure
root folder
|
| - Other project
| - amazingErik
so, logically, I would try to address my API for the AmazingErik project by heading to the following URL:
http://localhost/amazingErik/api/posts
however, this results in a NotFoundHttpException. Accoarding to this question I should be referring to the following address:
http://localhost/api/posts
However, this simply results in a 'Not found' message. This is what my api.php looks like:
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('/posts', function(){
return 'Hello World';
});
So, my intention is to navigate to http://localhost/amazingErik/api/posts
and fetch the result 'Hello World'. However, currently I have no idea on how to rectify this behaviour. I have no other method by which I can address my API so far.