-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
29 lines (24 loc) · 926 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
<?php
$loader = require 'vendor/autoload.php';
$loader->add('App\\', __DIR__.'/src/');
$app = new \Slim\App;
$container = $app->getContainer();
$container['errorHandler'] = function ($container) {
return function ($request, $response, $exception) use ($container) {
return $container['response']->withStatus(500)
->withHeader('Content-Type', 'text/html')
->write($exception);
};
};
$container['\App\Controller\DiscountController'] = function ($container) {
$discountService = new \App\Service\DiscountService();
$customerRepository = new \App\Repository\CustomerRepository();
$orderRepository = new \App\Repository\OrderRepository();
return new \App\Controller\DiscountController(
$discountService,
$customerRepository,
$orderRepository
);
};
$app->get('/discount/calculate', '\App\Controller\DiscountController:calculate');
$app->run();