blob: 071c86c2884207a5dc15af878c8b27ded0d28c19 (
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('/note/:id', function (array $args) {
$note = Note::find($args['id']);
if ($note == null || $note->deleted) {
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 notes sorry");
}
json_response($note);
});
|