$app->put('/:resource/:id(/)', function ($resource, $id = null) {
    $resource = \App\Resource::load($resource);
    if ($resource === null) {
        \App\Resource::response(\App\Resource::STATUS_NOT_FOUND);
    } else {
        $resource->put($id);
    }
});
// Delete
$app->delete('/:resource/:id(/)', function ($resource, $id = null) {
    $resource = \App\Resource::load($resource);
    if ($resource === null) {
        \App\Resource::response(\App\Resource::STATUS_NOT_FOUND);
    } else {
        $resource->delete($id);
    }
});
// Options
$app->options('/:resource(/)', function ($resource, $id = null) {
    $resource = \App\Resource::load($resource);
    if ($resource === null) {
        \App\Resource::response(\App\Resource::STATUS_NOT_FOUND);
    } else {
        $resource->options();
    }
});
// Not found
$app->notFound(function () {
    \App\Resource::response(\App\Resource::STATUS_NOT_FOUND);
});
$app->run();