기본 콘텐츠로 건너뛰기

라벨이 model인 게시물 표시

vulcanJS - 4. 글쓰기를 위한 graphQL 모델 만들기

조금 어려울지도 모릅니다. 이제까지 쉽게쉽게 왔습니다만 여기서부터 갑자기 이것저것 많이 나옵니다. 그러니 너무 상심하지말고 차분하게 따라가봅시다. 신나는 백엔드의 세계에 오신 걸 환영합니다 :) 글쓰기를 구현하기 위해 Posts라는 모델을 만들어봅시다. 여담이지만 N개의 목록으로 구성하는 것들을 Collection이라고 하는데 보통 복수형인 s를 뒤에 붙여서 만드는 것이 일반적입니다. 첫글자를 대문자로 시작하는 Camel Notation도 사용합니다. $ vulcan g model 하고 쳐봅니다. 패키지 이름 선택하고 나서 Model name을 입력합니다. resolvers와 mutations는 디폴트 No로 엔터엔터하시고나면 ? Add a custom property to the collection (y/N) 라고 나옵니다. $ vulcan g model ? Package name spectrum-simplebb ? Model name Posts ? Add custom resolvers No ? Add custom mutations No ? Add a custom property to the collection (y/N) 소스를 수정해서 해도 되지만 우리는 아무것도 아는게 없으니 custom property를 줘서 만들어봅시다. 글쓰기에서 중요한 게 무엇일까요? 잘 생각이 나진 않지만 최소 "제목", "본문글" 정도는 있어야겠다는 생각이 듭니다. 일단 y 하고 title, body를 각각 String 타입으로 생성해봅시다. ? Add a custom property to the collection Yes ? Property name title ? Property is hidden No ? Property label Title ? Property type String ? Property is optional No ? Property viewable by Guests ? P...