scandiweb-products/index.php

19 lines
567 B
PHP
Raw Normal View History

2022-07-27 11:44:08 -04:00
<?php
require 'autoload.php';
2022-07-27 14:26:50 -04:00
use ProductList\Http\Request;
use ProductList\Http\RequestHandler;
use ProductList\Http\Route;
$request = new Request($_SERVER);
$handler = new RequestHandler($request);
$handler->registerRoutes([
2022-07-28 03:19:11 -04:00
new Route('GET', 'products', ['ProductList\View\Product', 'list']),
new Route('DELETE', 'products', ['ProductList\View\Product', 'delete']),
2022-07-28 01:23:22 -04:00
new Route('GET', 'add-product', function() { readfile('static/add-product.html'); }),
new Route('GET', '', function() { readfile('static/index.html'); }),
2022-07-27 14:26:50 -04:00
]);
$handler->handle();