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必須存在且唯一。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM