scandiweb-products/index.php

21 lines
719 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;
2022-07-28 08:16:55 -04:00
$request = new Request($_SERVER, $_GET, $_POST);
2022-07-27 14:26:50 -04:00
$handler = new RequestHandler($request);
$handler->registerRoutes([
2022-07-28 08:16:55 -04:00
new Route('GET', 'test', ['ProductList\View\Product', 'test']),
new Route('GET', 'product', ['ProductList\View\Product', 'get']),
new Route('DELETE', 'product', ['ProductList\View\Product', 'delete']),
new Route('POST', 'product', ['ProductList\View\Product', 'post']),
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();