get('/link/{content}/{mimetype}', function ($request, $response, array $args) { $streamFactory = new StreamFactory(); $stream = $streamFactory->createStreamFromFile('/var/www/public/storage/files/' . $args['content']); return $response ->withHeader('Content-Type', base64_decode($args['mimetype'])) ->withBody($stream); }); $app->add(new ResponseMiddleware); $app->add(new CorsMiddleware()); // Add error middleware $app->addErrorMiddleware(true, true, true); $app->group(QueueController::path(), QueueController::route()); $app->group(PausaController::path(), PausaController::route()); $app->group(AuthController::path(), AuthController::route()); $app->group(AtendimentosController::path(), AtendimentosController::route()); $app->group(WebhookController::path(), WebhookController::route()); $app->group(MessageController::path(), MessageController::route()); $app->group(SupervisorController::path(), SupervisorController::route()); $app->group(EmpresaController::path(), EmpresaController::route()); $app->group(ConfigAtendimentoController::path(), ConfigAtendimentoController::route()); $app->group(NumberChannelController::path(), NumberChannelController::route()); $app->run();