今天在學習使用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必須存在且唯一。
