如何解决localhost/docs 打不开,api 平台
我正在尝试使用 API 平台为我的 REST API 创建实体。 我正在学习本教程,我现在正在这一步:https://api-platform.com/docs/distribution/#plugging-the-persistence-system
我将我的实体更改为使用 Doctrine\ORM\ 并且 localhost/docs 因错误 502 停止工作,老实说我不知道为什么。 当我尝试打开 localhost/admin 时出现此错误:
Unhandled Runtime Error
Error: Cannot fetch API documentation:
Status: 502
Call Stack
eval
webpack-internal:///./node_modules/@api-platform/admin/lib/hydra/dataProvider.js (505:13)
这是我的实体代码:
<?PHP
// api/src/Entity/User.PHP
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
/**
* A user
*
* @ORM\Entity
*/
#[ApiResource]
class User
{
/**
* User ID
*
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private int $id;
/**
* User name
*
* @ORM\Column
*/
public string $name;
public function getId(): ?int
{
return $this->id;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。