freeCodeCamp/api
2025-01-02 18:21:55 +05:30
..
__mocks__ breaking(api): remove submission time from exam env (#57365) 2024-12-06 09:50:37 +01:00
prisma feat(api): add /submit-quiz-attempt endpoint (#57201) 2024-12-06 12:45:12 -06:00
src chore(api): add log level configuration 2025-01-02 18:21:55 +05:30
tools chore(api): remove version field from docker-compose.yml (#57310) 2024-11-25 13:48:42 +02:00
.gitignore feat: create docker images for new api (#51538) 2023-09-13 02:15:25 +05:30
jest.config.ts test: speed up api tests (#53969) 2024-03-09 10:36:19 +05:30
jest.utils.test.ts test: minor fix to how cookies are passed around (#55259) 2024-06-21 08:36:46 -07:00
jest.utils.ts chore(api): add ExamEnvironmentAuthorizationToken -> user relation (#56627) 2024-10-25 10:10:26 +02:00
package.json chore: upgrade mongodb (#56829) 2024-10-25 11:26:54 +05:30
README.md feat(api): add exam-environment endpoints (#55662) 2024-10-04 09:20:18 -05:00
tsconfig.build.json feat: create docker images for new api (#51538) 2023-09-13 02:15:25 +05:30
tsconfig.json refactor(api): import ts-reset in entrypoint (#51677) 2023-09-28 09:40:51 -07: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

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.

Generating Exams

pnpm run generate-exams <ENV_EXAM_ID> <NUMBER_OF_EXAMS_TO_GENERATE>