Commit 45c6aa7a authored by Mat's avatar Mat

vérification d'une première route de l'API/v2 en GET avec postman

parent c964e7da
......@@ -103,7 +103,7 @@ lexik_jwt_authentication:
# Nelmio CORS
nelmio_cors:
paths:
'^/api/':
'^/API/':
allow_origin: ['*']
allow_headers: ['X-Custom-Auth']
allow_methods: ['POST', 'PUT', 'GET', 'DELETE', 'PATCH']
......@@ -121,7 +121,7 @@ fos_rest:
enabled: true
format_listener:
rules:
path: ^/api
path: ^/API
priorities: [json]
fallback_format: 'json'
view:
......
......@@ -29,7 +29,7 @@ security:
security: false
main:
pattern: ^/
anonymous: false
anonymous: true
# un anonyme n'aura accès qu'aux pages login et register
form_login:
login_path: login
......
<?php
namespace Api2Bundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class DefaultController extends Controller
{
/**
* @Route("/")
*/
public function indexAction()
{
return $this->render('Api2Bundle:Default:index.html.twig');
}
}
<?php
namespace Api2Bundle\Controller;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Controller\FOSRestController;
use SocketBundle\Entity\Message;
class MessageController extends FOSRestController
{
/**
* @Rest\Get("/message")
* @Rest\View()
*/
public function getAction()
{
return $this->getDoctrine()
->getRepository(Message::class)
->findAll();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment