aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/note.php
blob: e43c2a1cb17474971d9f7cd61e40fe2ab2624c53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

use WpfTest\HttpResponseStatus\NotFound;
use WpfTest\Model\Actor;
use WpfTest\Model\Note;
use WpfTest\Model\NoteAttachment;
use WpfTest\Router;

Router::getInstance()->mount('/post/:id', function (array $args) {
    $note = Note::find($args['id']);
    if ($note == null) {
        throw new NotFound("i don't know that note");
    }
    if (!$note->author->isLocal) {
        throw new NotFound("i don't want to tell you about non local posts sorry");
    }
    json_response($note);
});