<?php
require_once "{$_SERVER['DOCUMENT_ROOT']}/dependencies.php";
$token = $db->querySingle("SELECT sign(('{\"exp\":' || EXTRACT(EPOCH FROM NOW() + INTERVAL'1 day') || ', \"role\": \"app_user\"}')::JSON, '{$_ENV['KEY_ENCRYPT']}') as token");
$_SESSION['user'] = [
    'id' => 1,
    'name' => 'Ángel Alfonso',
];
header('Content-Type: application/json');
echo json_encode($token);
