freeCodeCamp/api
renovate[bot] 5a1c22723e fix(deps): update prisma monorepo to v5.5.2 2023-11-05 12:25:40 +00:00
..
__mocks__ feat(api): add exam utils and GET /exam/:id endpoint to new api (#51609) 2023-10-26 13:35:09 +05:30
prisma feat(api): DELETE /user/ms-username (#51778) 2023-11-01 09:28:04 -05:00
src fix(api): trim trailing space if no reporter name (#52199) 2023-11-03 16:38:19 +01:00
tools feat(api): add prisma as orm (#49413) 2023-03-14 17:29:55 +00:00
.gitignore feat: create docker images for new api (#51538) 2023-09-13 02:15:25 +05:30
README.md docs: improve new api's mongodb setup guide (#50392) 2023-05-16 20:04:41 +04:00
jest.config.ts feat(api): add CORS headers (#50120) 2023-04-26 09:02:12 +02:00
jest.utils.test.ts feat(api): add csrf protection (#50275) 2023-05-18 17:06:40 +05:30
jest.utils.ts feat(api): POST /ms-trophy-challenge-completed (#51808) 2023-11-03 10:00:55 +01:00
package.json fix(deps): update prisma monorepo to v5.5.2 2023-11-05 12:25:40 +00: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

README.md

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.