get('/', function(Application $app, Request $request) { $template_name = $request->query->get('template'); if (!preg_match('/^[a-zA-Z0-9-_]+$/', $template_name)) { throw new BadRequestHttpException('Wrong template name : ' . $template_name); } $template_path = realpath(__DIR__ . '/../../../../../templates/web/Mustache/Prod/' . $template_name . '.Mustache.html'); if (!file_exists($template_path)) { throw new NotFoundHttpException('Template does not exists : ' . $template_path); } return new \Symfony\Component\HttpFoundation\Response(file_get_contents($template_path)); }); return $controllers; } }