src/Controller/Api/LocationController.php line 21

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller\Api;
  4. use App\Service\AvailableCountriesProvider;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\JsonResponse;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. #[Route(path'/location')]
  9. class LocationController extends AbstractController
  10. {
  11.     #[Route(
  12.         path'/available-countries',
  13.         name'api_get_available_countries',
  14.         options: ['expose' => true],
  15.         methods: ['GET'])
  16.     ]
  17.     public function availableCountries(AvailableCountriesProvider $availableCountriesProvider): JsonResponse
  18.     {
  19.         return $this->json(['countries' => $availableCountriesProvider->provide()]);
  20.     }
  21. }