Issue
I am working in a Vue app with a Laravel api and I am getting exactly what it says in the title.
My Axios call: return await axios.post("/customers/load-cart-data", payload);
Inside the general section of my network tab: Request Method: POST
What I get back from our api: "message": "The GET method is not supported for this route. Supported methods: POST."
I even log out the req
in an interceptor and it says: ....,method: "post"
I am just wondering if there is some server routes configuration something that is missing or if there is anything I can do to fix this.
Thank you all!
Solution
This could happens when you declare the same name of route for api.php and web.php with different method, for a api.php you should use post method and web.php should be routes for pages.
After change the route names on your api on the console write this command.
php artisan route:clear
with this you should clear all routes cache and after this try test your api.
Answered By - Fernando Balta Jhong Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.