-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.php
28 lines (20 loc) · 923 Bytes
/
server.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
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Sh1ne\MySqlBot\Application;
use Sh1ne\MySqlBot\Controllers\SlackController;
use Sh1ne\MySqlBot\Controllers\StatusController;
use Sh1ne\MySqlBot\Core\Http\Kernel;
use Sh1ne\MySqlBot\Core\Http\Router;
use Sh1ne\MySqlBot\Middleware\LogRequestsMiddleware;
use Sh1ne\MySqlBot\Middleware\SlackAuthorization;
use Sh1ne\MySqlBot\Middleware\SlackVerificationMiddleware;
$application = new Application(__DIR__);
$kernel = new Kernel($application);
$kernel->boot();
$router = app(Router::class);
$router->middleware('/', new LogRequestsMiddleware());
$router->middleware('/api/v1/slack/events', new SlackVerificationMiddleware());
$router->middleware('/api/v1/slack/', new SlackAuthorization());
$router->get('/api/v1/status', [StatusController::class, 'index']);
$router->post('/api/v1/slack/events', [SlackController::class, 'handleEvent']);
$kernel->handleRequest();