-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
31 lines (25 loc) · 900 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
require __DIR__ . '/vendor/autoload.php';
use Slim\Http\Request;
use Slim\Http\Response;
use NYPL\Starter\Service;
use NYPL\Services\Controller;
use NYPL\Starter\Config;
use NYPL\Starter\ErrorHandler;
try {
Config::initialize(__DIR__ . '/config');
$service = new Service();
$service->get("/docs/doc", function (Request $request, Response $response) {
return \NYPL\Starter\SwaggerGenerator::generate(
[__DIR__ . "/src", __DIR__ . "/vendor/nypl/microservice-starter/src"],
$response
);
});
$service->get("/api/v0.1/docs", function (Request $request, Response $response) {
$controller = new Controller\SwaggerController($request, $response);
return $controller->getDocs();
});
$service->run();
} catch (Exception $exception) {
ErrorHandler::processShutdownError($exception->getMessage(), $exception);
}