From e1ad307b531c27ec6bfaf8b4d018991b0d4a78f3 Mon Sep 17 00:00:00 2001 From: winter Date: Fri, 6 Dec 2024 20:43:26 +0000 Subject: initial commit hardcoded functionality mostly! --- routes/actor.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 routes/actor.php (limited to 'routes/actor.php') diff --git a/routes/actor.php b/routes/actor.php new file mode 100644 index 0000000..230f342 --- /dev/null +++ b/routes/actor.php @@ -0,0 +1,39 @@ +mount('/user/:username', function (array $args) { + if ($args['username'] != 'winter') { + throw new NotFound('i only know about winter'); + } + json_response([ // hardcoded much for testing + 'type' => 'actor', + 'self' => path_to_uri('/user/winter'), + 'created' => '2024-12-06T19:40:00+00:00', + 'homepage' => path_to_uri('/winter'), + 'handle' => 'winter', + 'displayName' => 'winter!', + 'bio' => 'winter on php', + 'pronouns' => 'it/she', + 'automated' => false, + 'endpoints' => [ + 'basicFeed' => path_to_uri('/user/winter/basicFeed') + ] + ]); +}); + +Router::getInstance()->mount('/user/:username/basicFeed', function (array $args) { + if ($args['username'] != 'winter') { + throw new NotFound('i only know about winter'); + } + json_response([ + 'page' => 1, + 'totalPages' => 1, + 'nextPage' => null, + 'previousPage' => null, + 'items' => [ + path_to_uri('/post/1') + ] + ]); +}); \ No newline at end of file -- cgit v1.3