You send a GET request to a POST route, send a POST request instead
Feb 19, 2021
10
Level 4
API Routes saying 405 Method not allowed
Error says that the GET Method is not supported but the method registered is a route method. I can't seem to figure out what exactly is going on.
api.php file
Route::post('register', RegistrationController::class)->name('api.register');
Route::post('login', LoginController::class)->name('api.login');
This is the error I get in postman:
{
"message": "The GET method is not supported for this route. Supported methods: POST.",
"exception": "Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException",
"file": "/Users/delaakakpo/Projects/afap-ims/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php",
"line": 117,
"trace": [
{
"file": "/Users/delaakakpo/Projects/afap-ims/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php",
"line": 103,
"function": "methodNotAllowed",
"class": "Illuminate\Routing\AbstractRouteCollection",
"type": "->"
},
}
Here's an image of the request in insomnia:
Please or to participate in this conversation.