You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.9 KiB
59 lines
1.9 KiB
<?php |
|
|
|
use app\Controllers\AtendimentosController; |
|
use app\Controllers\AuthController; |
|
use app\Controllers\ConfigAtendimentoController; |
|
use app\Controllers\EmpresaController; |
|
use app\Controllers\MessageController; |
|
use app\Controllers\NumberChannelController; |
|
use app\Controllers\PausaController; |
|
use app\Controllers\QueueController; |
|
use app\Controllers\SupervisorController; |
|
use Slim\Factory\AppFactory; |
|
use Slim\Routing\RouteCollectorProxy; |
|
use app\Controllers\WebhookController; |
|
use app\Middlewares\ResponseMiddleware; |
|
use Tuupola\Http\Factory\StreamFactory; |
|
use Tuupola\Middleware\CorsMiddleware; |
|
|
|
include __DIR__ . '/includes/config.php'; |
|
require __DIR__ . '/vendor/autoload.php'; |
|
|
|
// Instantiate App |
|
$app = AppFactory::create(); |
|
|
|
$app->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(); |