The api not work in Postman when requested by url - php

i have start the server using xampp
http://localhost/api/login
used this url in postman for request and still get this error
**Not Found
The requested URL was not found on this server.
Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.2.0 Server at localhost Port 80**
my route in api.php is
Route::post('login',[userController::class,'userLogin']);
I have tried with php artisan serve with url
http://127.0.0.1:8000/api/login
but didn't work

You need to clear your route cache by
php artisan route:cache
This is common when testing with Postman. Once your routes cache is cleared, your route will be picked up by Postman.

Related

View [admin.sellers.show] not foun | Illuminate/View/FileViewFinder.php | line 137

I deploy laravel 5.8 project on server, then when I was tryng to make delete request got this error
the project work fine on the local
this error show on another pages when it tring to make request delete request ,
View [admin.contacts.show] not found.
View [admin.brands.show] not found
php version : v7.4.33
I run this commands in server terminal
php artisan cache:clear
php artisan view:clear
php artisan config:cache
it still show the same error
note : I tried to deploy the same project on another server , I got the same error but it fixed with the previes command.
so did I miss something in the first server ?
here is my answer for my question , It's not one issue but 2 issues
first one is caching views , routes , and config
make sure to run this commands after each edit on the server.
php artisan view:cache
php artisan route:cache
php artisan config:cache
then for some reason my server delete request was not working
why I don't know, because of that the project was working fine locally and fine on another server .. after tens times of edits and tests with no real results because of app caching I didn't not that after a long time of trying and testing, and debugging.
I realized that in my server delete request is called the show method which is like destroy method URL https://url/sellers/{id} but with the get method, so, and show method has this unknown view.
in the end, I used the cache command after each time I made an edit on the server and changed the delete request to post request with pass _method: 'delete' as body request and it's fixed.
note: delete request may work on another server because it's works on my second server
my test :
delete request only
response
delete request with _method:'delete'
request body
response
finaly with post request and _method: 'delete'
request body
response
done

All requests ends up in GET route. Laravel

I have a Laravel(8.83) application. API routes end up in GET requests always.
To check the problem I have deleted all the routes except one. Now I have just one route:
Route::put("cart/{id}", function(Request $request, $id) {
return $request->all();
});
Although I make PUT request on the postman, the result is: "The GET method is not supported for this route. Supported methods: PUT."
I have tried PUT, PATCH, POST, DELETE, and OPTIONS. All ended up in the same error.
Edit: 3 Oct 2022
I run php artisan optimize:clear and composer dump-autoload several times. None resolved the issue.
The project is in production, deployed on a server. I have made a request from a Vue.JS web app client, and the result is the same. I don't think the problem is caused by Postman.
The request method is probably getting modified in Postman or in webserver config, or in .htaccess.
Here's one thread on a similar issue in Postman - Postman support
For a reference to a working .htaccess - Laravel .htaccess GitHub

not found The requested resource / was not found on this server

I want to run a laravel project on local server but I have only the backup from server so I made some changes but now my php artisan is working but when coming to routes it shows that:
Not found theb requested resource/was not found on this server

Why doesn't native Laravel 5.4 authentication send to password reset page?

I made a basic project in Laravel 5.4 using PhpStorm and executed php artisan make:auth and php artisan migrate. After running php artisan serve, I accessed the resulting site on http://localhost:8000 and tested the password recovery. Using Gmail for SMTP, the corresponding user received an e-mail with a link like this:
http://localhost/password/reset/d55b8591a690c96742e192d31ba6b1c7b06cb4b390fa08baaf02ce261618b884
It redirects me to a 404 Error page.
Looking at php artisan route:list, there is a route called "password.reset", set on GET|HEAD with the following URI: password/reset/{token}. So it seams that should work, since there is a place for a token. The action is: App\Http\Controllers\Auth\ResetPasswordController#showResetForm
There's basically nothing on that controller, but it has use ResetsPassword from Illuminate\Foundation\Auth inside the class. When I try to overwrite the function, I look at the original and it does redirect to reset password view.
But something is not working. I tried to add :8000 to the link, but it just redirects me to a blank page and I'm sure the server is still serving at that port. What am I doing wrong?
You have to change APP_URL=http://localhost to APP_URL=http://localhost:8000 in the .env
Your route in the email must have the ":8000" that is the port of your application. Your browser if looking for the same route but in just in the localhost route without a port

Error during installation of sulu-demo

I try to install sulu.io demo website and i got an 407 error after executing app:install command.
Sorry, you are not currently allowed to request http://127.0.0.1:9200/sulu_ro
cks_articles from this cache until you have authenticated yourself.
I do not understand why i got this error. I am behind a proxy but it's a local url.
Elasticsearch is correctly accesible via the url http://127.0.0.1:9200

Categories