getMessage(); break; } $meta = json_encode([ "id" => $id, "deletion_password" => $password ]); // store markdown and metadata in data path file_put_contents(get_markdown_path($id), $content); file_put_contents(get_meta_path($id), $meta); echo $meta; break; case "PATCH": // TODO update using PATCH case "DELETE": break; } function get_markdown_path(string $id): string { return get_data_path() . $id . ".md"; } function get_meta_path(string $id): string { return get_data_path() . $id . ".json"; } function get_data_path(): string { return dirname(getcwd()) . "/data/"; }