1 pièce(s) jointe(s)
probleme au cours d'écrire rest api
Salut , je peux créer un rest api mais je trouve ce probléme au cours d'éxécuter la test
Pièce jointe 208340
code testing.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <?php
require __DIR__.'/vendor/autoload.php';
$client = new \GuzzleHttp\Client([
'base_url' => 'http://localhost:8000',
'defaults' => [
'exceptions' => false
]
]);
$response = $client->post('/api/programmers');
echo $response;
echo "\n\n"; |
code programmersController.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <?php
namespace CrudBundle\Controller\Api;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class ProgrammerController extends Controller {
/**
* @Route("/api/programmers")
* @method("POST")
*/
public function newAction() {
return new Response('Let\'s de this!');
}
} |
quelle est la solution et merci