Click here to Skip to main content
15,029,333 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello guys before few days i was working on laravel project and that time my laravel version was 5.7.36 and i maked api in 5.7.36 but now i have updated my project and now my laravel version is 5.8.36 but api is not working in it in 5.7 my all api is working perfectly please see my code and tell me what i need to do for this issue


here is the error that i am getting





<title>404 Not Found



Not Found


The requested URL was not found on this server.


Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.






Thanks.

What I have tried:

here is my api.php code:
get('/user', function (Request $request) {

return $request->user();
});
// routes/api.php
// POST /api/post?api_token=UNIQUE_TOKEN
Route::post('post', 'Api\PostController@store')->middleware('auth:api');

Route::get('/get/{business_id}','GetController@databybusinessid');

here is my model code:

get();
return response()->json($users);
}
}
Posted
Updated 3-Nov-20 0:56am
v2
Comments
phil.o 2-Mar-20 6:19am
   
You need to tell us the exact error message first.
Member 9983063 2-Mar-20 6:27am
   
in postman i am getting 404 error
Member 9983063 2-Mar-20 6:27am
   
please help me now am using laravel 5.8
Member 9983063 2-Mar-20 6:34am
   
here is the exact error




<title>404 Not Found



Not Found


The requested URL was not found on this server.
Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.
phil.o 2-Mar-20 6:38am
   
You should have used the green Improve question widget instead, so that everyone can pay attention to this information in the question itself.
How do I improve my question?
Member 9983063 2-Mar-20 6:44am
   
i have updated
ZurdoDev 2-Mar-20 7:55am
   
404 means it can't find the resource. Your url seems to be wrong.
Richard Deeming 3-Mar-20 7:16am
   
Route::post('post', 'Api\PostController@store')->middleware('auth:api');

Are you sure that shouldn't be a forward-slash instead of a backslash?
Route::post('post', 'Api/PostController@store')->middleware('auth:api');

1 solution

Go back to version 5.7.36, which was working and since you gave no reason for upgrading in the first place. One has choices.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900