From f6df0f3aedb1f7ba59ec516f199aa58d901f9d2e Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Tue, 16 May 2023 18:04:41 +0200 Subject: [PATCH] docs: improve new api's mongodb setup guide (#50392) * docs: improve new api's mongodb setup guide * docs: give example variable Co-authored-by: Naomi Carrigan * Update api/README.md --------- Co-authored-by: Naomi Carrigan Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> --- api/README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/api/README.md b/api/README.md index 5a14fd0f0b4..d6948ac8ffc 100644 --- a/api/README.md +++ b/api/README.md @@ -11,14 +11,27 @@ If you use MongoDB Atlas, the set is managed for you. ### Local The simplest way to run a replica set locally is to use the docker-compose file -in /tools. First disable any running MongoDB instance on your machine, then run -the docker-compose file. +in /tools. ```bash cd tools docker compose up -d ``` +Once that's running, update the connection string in the `.env` file to use port `27018`. + +```txt +# Database +MONGOHQ_URL=mongodb://127.0.0.1:27018/freecodecamp?directConnection=true +``` + +The new db will be empty, so you can run the seed script to populate it. + +```bash +cd ../.. # back to the root of the repo +pnpm seed +``` + ## Login in development/testing During development and testing, the api exposes the endpoint GET auth/dev-callback. Calling this will log you in as the user with the email `foo@bar.com` by setting the session cookie for that user.