<?php
require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/entity.php';

if ($_SERVER['REQUEST_METHOD'] !== 'POST') json_error('Método no permitido.', 405);
require_admin($config);

$fields = entity_validate_input(body_json());
$id = entity_create($pdo, 'tutorials', $fields);

json_ok(['id' => $id], 201);
