Newer
Older
<?php
use Slim\App;
use Slim\Psr7\Response;
function setupRoutes(App $app) {
# API Routes
$app->post('/create/{domain}', '\SmartDataContext\Controller\Crud:create');
$app->post('/associate/{domain}', '\SmartDataContext\Controller\Crud:associate');
$app->post('/unassociate/{domain}', '\SmartDataContext\Controller\Crud:unassociate');
$app->get('/get/{domain}/{id}', '\SmartDataContext\Controller\Crud:get');
$app->post('/query/{domain}', '\SmartDataContext\Controller\Crud:query');
$app->post('/contexts/{domain}', '\SmartDataContext\Controller\Crud:contexts');
$app->post('/update/{domain}/{id}', '\SmartDataContext\Controller\Crud:update');
$app->post('/unstructured/add/{domain}/{id}', '\SmartDataContext\Controller\Crud:addUnstructuredData');
$app->post('/unstructured/remove/{domain}', '\SmartDataContext\Controller\Crud:removeUnstructuredData');
$app->post('/unstructured/get/{domain}', '\SmartDataContext\Controller\Crud:getUnstructuredData');
# Documentation
$app->get('/docs', function ($request, Response $response) {
$response->getBody()->write(file_get_contents(__DIR__ . '/swagger/swagger-ui.html'));
return $response;
});
$app->get('/openapi', function ($request, $response, $args) {
$response->getBody()->write(file_get_contents(__DIR__ . '/swagger/openapi.yaml'));
return $response;
});
return $app;
}