-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroutes.php
24 lines (19 loc) · 1002 Bytes
/
routes.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
<?php
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use \HotRodCli\Api\Processor;
use \HotRodCli\Api\GetCommands;
use \HotRodCli\Api\GetCommand;
/** @var \Slim\App $api */
$api->post('/create/{command}', function (ServerRequestInterface $request, ResponseInterface $response, $args) use ($app) {
return $response->getBody()->write($app->resolve(Processor::class)($request, $args));
});
$api->get('/commands', function(ServerRequestInterface $request, ResponseInterface $response) use ($app) {
return $response->getBody()->write($app->resolve(GetCommands::class)());
});
$api->get('/command/{command}', function(ServerRequestInterface $request, ResponseInterface $response, $args) use ($app) {
return $response->getBody()->write($app->resolve(GetCommand::class)($args));
});
$api->get('/', function (ServerRequestInterface $request, ResponseInterface $response) {
return $response->withStatus(302)->withHeader('Location', '/dist/ui-app');
});