본문 바로가기

db4

strapi Collection 생성과 사용 Collection 기본적으로 collection은 DB의 table이다. 실제로 strapi가 생성하는 collection은 실제 DB에서도 table로 생성된다. PLUGINS/Content-Types Builder를 누른후 나타나는 오른쪽 화면에서 + Create new collection type 을 클릭한다. collection type의 이름을 설정한다. 이 이름은 table name이라고 생각할 수 있다. 다만 Display name은 현재 strapi에서 보여지는 이름이며 고급 설정에 실제로 DB table이름으로 사용될 collection name도 따로 설정은 할 수 있다. Todo List를 만든다는 가정하에, task라는 이름으로 하나의 Collection을 생성한다. 그다음 fie.. 2020. 12. 3.
str api, DB와 RestAPIs 모든 세팅을 끝나고 나면, 이제 DB와 API를 생성할 수 있는 상태가 된 것이다. 이후 부터 기본적인 CRUD가 가능한 Server를 Control 할 수 있게 된다. DB strapi에서 DB는 Collection Types라는 이름으로 DB Table을 나타낸다. 동시에 Users, User라는 Rest API의 Router도 생성된다. sqlite 기준으로 기본적으로 생성된 DB를 보면 아래와 같다. 다른 것들은 strapi의 기본적인 기느들과 관련되거나, role등에 관련된 것이라서 직접 손댈일이 없다. users-permissions_user라는 Table을 볼 수 있으며, Collection Types Users에 매핑되는 Table이다. 테이블 이름의 규칙 기본적으로 strapi가 생성하는.. 2020. 10. 4.
strapi Server & DB configuration 살펴보기 Configuration strapi db configuration strapi config folder strapi project로 생성된 폴더중 config라는 폴더를 확인할 수 있다. 기본적으로 2개의 파일을 확인 할 수 있다. database.js: database setting sourcecode 아래 코드는 기본적으로 생성되는 sqlite의 경우. module.exports = ({ env }) => ({ defaultConnection: 'default', connections: { default: { connector: 'bookshelf', settings: { client: 'sqlite', filename: env('DATABASE_FILENAME', '.tmp/data.db'), }.. 2020. 9. 15.
strapi란? strapi(Headless cms) strapi란? Back-End 개발의 최소한의 노력으로 가능하게 해주는 Framework이다. Back-End의 기본은 CRUD + DB + API(Service)로 볼수 있다. strapi 소스를 설치하고 실행하면, Admin Page를 통해 DB 생성 관리, RestAPI, Data CRUD가 가능하다. strapi 설치와 실행 준비 사항 nodejs 12.x 이상 버젼 postgre sql 또는 Mysql server vs code(필수 항목은 아님) 설치와 실행 strapi npm install, CLI 실행 strapi cli를 npm install을 통하여 설치한후 strapi프로젝트를 실행시키는 방법 install guide link strapi sou.. 2020. 9. 7.