Nest.js运行时报错No repository for "Hero" was found. Looks like this entity is not registered in current "default" connection
今天在学习使用nest.js+graphql时,运行npm run start,报错No repository for "Hero" was found. Looks like this entity is not registered in current "default" connection。
原因是没有创建名为Hero的entity。由于是初次接触graphql,我只创建了名为Hero的一个ObjectType(graphql中用于构建schema的对象),而没有创建entity。
事实上,我们可以根据业务需求创建不同的ObjectType,或是不创建ObjectType而是只采用entity,但是entity必须存在且唯一。
优质内容筛选与推荐>>