I solved my problem:
POST and GET requests from my API to my API do not work, because I used
php artisan serve
therefore, requests from localhost: 8000 / api to localhost: 8000 / api / hello do not work, but GET requests from localhost: 8000 / api to http://www.google.com/ did. Example:
$app->get('api', function() use ($app) {
$client = new \GuzzleHttp\Client();
$response = $client->get('http://www.google.com/');
return $response;
});
Lumen API localhost www/folder (C:\wamp\www windows /var/www/html/on linux)
$app->get('api', function() use ($app) {
$client = new \GuzzleHttp\Client();
$response = $client->get('localhost/api/hello');
return $response;
});
$app->get('api/hello', function() use ($app) {
return "Hello";
});
.
, , Lumen API ( ):
Lumen C:\wamp\www\api
.htaccess , : C:\wamp\www\api \.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
</IfModule>
C:\wamp\www\api\server.php C:\wamp\www\api\index.php
C:\wamp\www\api\public\index.php
$app->run();
$request = Illuminate\Http\Request::capture();
$app->run($request);
mod_rewrite!