-
Notifications
You must be signed in to change notification settings - Fork 0
ch00_installation
Daniel Samson edited this page Oct 15, 2019
·
15 revisions
composer require daniel-samson/teensyphp
<?php
require_once __DIR__ . '/vendor/autoload.php';
display_errors(false);
error_reporting(E_ALL);
try {
// home / landing page
route(method(GET), url_path("/"), function () {
render(200, json_out(['hello' => 'world']));
});
// route not found
render(404, json_out(['error' => 'not found']));
} catch (Exception $e) {
error_log($e->getMessage());
error_log($e->getTraceAsString());
render($e->getCode(), json_out(['error' => 'internal server error']));
} catch (Error $e) {
error_log($e->getMessage());
error_log($e->getTraceAsString());
render($e->getCode(), json_out(['error' => 'internal server error'])));
}