46 lines
1010 B
PHP
Raw Normal View History

2019-01-05 21:26:36 +01:00
<?php
namespace Infinito\Controller;
2019-01-05 21:26:36 +01:00
use Symfony\Component\HttpFoundation\Response;
2019-01-06 02:24:35 +01:00
use Symfony\Component\HttpFoundation\RedirectResponse;
2019-01-05 21:26:36 +01:00
use Symfony\Component\HttpFoundation\Request;
2019-01-06 02:24:35 +01:00
use Symfony\Component\Routing\Annotation\Route;
2019-01-05 21:26:36 +01:00
/**
* Offers an SPA with Vue.js.
*
* @see https://vuejs.org/
* @see https://de.wikipedia.org/wiki/Single-Page-Webanwendung
*
* @author kevinfrantz
*/
2019-01-06 02:24:35 +01:00
final class SPAController extends AbstractController
2019-01-05 21:26:36 +01:00
{
2019-01-06 02:24:35 +01:00
/**
* @todo put this in an .env file
*
* @var int
*/
const SPA_PORT = 82;
private function getSpaUrl(Request $request): string
{
$url = str_replace('/spa/', '', $request->getUri());
$url = str_replace('/spa', '', $url);
$url .= ':'.self::SPA_PORT;
return $url;
}
/**
* @Route("/spa",methods={"GET"})
*
* @return Response
*/
public function spa(Request $request): RedirectResponse
2019-01-05 21:26:36 +01:00
{
2019-01-06 02:24:35 +01:00
return new RedirectResponse($this->getSpaUrl($request));
2019-01-05 21:26:36 +01:00
}
}