strapi와 MongoDB 연동하기

MongoDB 설치하기

strapi 프로젝트 생성

yarn create strapi-app my-project

프로젝트 생성 시 아래와 같이 Custom 옵션을 선택한다.

? Choose your installation type
Quickstart (recommended)
❯ Custom (manual settings)

다음으로 database 선택 옵션에서 mongo를 선택한다.

? Choose your installation type Custom (manual settings)
? Choose your default database client
sqlite
postgres
mysql
❯ mongo

dabtabase 옵션은 다음과 같이 선택한다. MongoDB 계정은 admin으로 해야한다. MacOS에 MongoDB 설치 하기 에서 설정한 admin 계정 정보를 입력한다.

? Choose your installation type Custom (manual settings)
? Choose your default database client mongo
? Database name: my-project
? Host: 127.0.0.1
? +srv connection: false
? Port (It will be ignored if you enable +srv): 27017
? Username: admin
? Password: *
? Authentication database (Maybe "admin" or blank):
? Enable SSL connection: No

strapi 실행

cd my-project
yarn develop

참고

Leave a Reply