Post with API Hi I am using Laravel 8.
Route::post('baseStation', [BaseStationController::class, 'send']);
I have this route on "api.php" but when I try to go "localhost/send/basestation" the page not found, it gives me 404. On the other hand, I heve
Route::get('baseStation', [BaseStationController::class, 'api']);
and this is workin. It gives me json. How can I fix this?
It looks like you are trying to make a POST request to the baseStation route, but you have only defined a GET route. To fix this, you will need to add a POST route to your api.php file.
Route::post('baseStation', [BaseStationController::class, 'send']);
Once you have added the POST route, you should be able to make a POST request to the baseStation route.
Aren’t your api routes prefixed with api?
Please sign in or create an account to participate in this conversation.