I have just created a Laravel project and testing the first endpoint through Insomnia, however, this always returns 404.
In the project directory, I have installed valet
and used its URL, which then returns 404 whenever I run a request through Insomnia.
Also when I run valet open
from the project directory this opens a web page with the Laravel main page which makes me think that valet
is working fine.
api.php
Route::group([
'middleware' => 'api',
'prefix' => 'auth'
], function ($router) {
Route::post('register', 'AuthController@registerUser');
Route::get('', 'AuthController@testing');
});
AuthController.php
public function registerUser()
{
return response()->json('User signed up');
}
public function testing()
{
return response()->json('Test ok');
}
The snipped code above is the route that I currently have in place which should simply go to the AuthController file and run the registerUser method.
Whatever I am doing on Insomnia is: