blob: be7eb25ff64de1d30ca3cf0ea03579c7cc6db552 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?php
use Digitigrade\HttpResponseStatus\NotFound;
use Digitigrade\Model\Note;
use Digitigrade\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);
});
|