<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class IndexController extends AbstractController {
#[Route('/')]
public function number(): Response {
return $this->render("index.html.twig");
}
#[Route('/twitch')]
public function twitch(): Response {
return $this->render("twitch.html.twig");
}
#[Route('/twitch/data')]
public function twitch_data(Request $request): JsonResponse {
$type = $request->query->get("data");
$json = new \stdClass();
$json->result = "success";
$json->content = $this->renderView("twitch/" . $type . ".html.twig", []);
return new JsonResponse($json);
}
}