<?php

return [
  'pattern' => '(:all)remove-file.json',
  'method' => 'POST',
  'action'  => function () {
      $json = file_get_contents('php://input');
      $data = json_decode($json);

      $page = page($data->pageUri);
      $file = $page->file($data->fileName);

      $file->delete();

      $page->update();

      return json_encode("File successfully removed.");
  }
];