mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-02 12:03:49 -05:00
* test: allow mocking of env vars Since utils/env is a module, we can mock it to control env vars in tests. However, it's not compatible with building the server in setupFilesAfterEnv, so, instead, we can use a utility function to keep things DRY. * fix: update type of fastifyTestInstance * chore: add comment about sts preload * chore: rename header plugin * test: add get util + provide origin on request * feat: add cors headers * chore: add TODO
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. First disable any running MongoDB instance on your machine, then run the docker-compose file.
cd tools
docker compose up -d
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.