V
V
VladimirKrasnov2020-11-26 15:39:19
Laravel
VladimirKrasnov, 2020-11-26 15:39:19

Why api stopped working on Laravel?

Sitting means learning to write api on Laravel.

Route::get('{user_id}', 'Api\[email protected]');

public function getUser($user_id) {       
    return response()->json(User::find($user_id), 200);       
}


I checked through Postman, everything is OK, I get the user and the status is 200. I turned off the computer and went to the store. Come on, I think we need to continue. Again I climb into the postman and this route does not work for me anymore. First I got a 404 error, then I reset the cache php artisan cache:clear, route:cache and now I don't get anything at all. Status 200, but no data. I have no idea where the trouble happened.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question