Files
freeCodeCamp/api
Muhammed Mustafa 885cf86cd6 feat(api): add socials links endpoint (#50332)
* feat(api): add socials links endpoint

* Sort the typo in body call

Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com>

* Revert "Sort the typo in body call"

This reverts commit 0588d3d70d.

---------

Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com>
2023-05-18 17:29:43 +04:00
..

Working on the new api

Connecting to local database

The api uses the ORM Prisma and it needs the MongoDB instance to be a replica set.

Atlas

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.

cd tools
docker compose up -d

Once that's running, update the connection string in the .env file to use port 27018.

# 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.

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.