Configuring a PhpStorm RESTful client to work with Laravel

I am trying to create a RESTful API with Laravel using the PhpStorm server and artisan, but when I try to test using the Rest Client, I get this error:

enter image description here

Now I only write the GET method and get the correct output in my browser with the address http://localhost:8000/users

This is my code:

routes.php

Route::resource('users','UserController');

UserController.php

public function index()
{
    return \Response::json(User::all());
}

I also tried adding json to the request window enter image description here

+4
source share
1 answer

php artisan serve --host 127.0.0.1 gotta do the trick.

It looks like PHPStorm is searching by localhost, which leads to 127.0.0.1. But php artisan servebinds to the local IPv6 address ::1.

+4
source

Source: https://habr.com/ru/post/1589050/


All Articles