Home > Net >  Why do i keep getting "The GET method is not supported for this route. Supported methods: POST.
Why do i keep getting "The GET method is not supported for this route. Supported methods: POST.

Time:01-02

Im having a problem while developing an api with laravel. The problem im having is that i keep getting this error "The GET method is not supported for this route. Supported methods: POST." across most of my routes.

I dont know why im getting the "GET method is not supported", im not even using it. Here is the actual route:

Route::post('/addEvent', [SpecialEventsController::class, 'store']);

To try and fix it i tried switching the method from post to get and that does remove the error but it brings another one. And also the get method isnt the appropriate method so it wont work. When i tried sending requests on postman everything seemed to work fine. The problem is only when i try on a browser.

CodePudding user response:

You can't hit your post method in browser tab where you can only hit "GET" method. "POST" method is only for submitting. While get method is used to retrive things and hit in browser URL holder.

CodePudding user response:

You can use programs like postman to Request, get results, and test the API Or if you need lighter tools, there is an add-on for VScode (Thunder Client), which is light and does the job

enter image description here

This can be done using js code But it doesn't need to be all that complicated as long as there are good testing tools

  • Related