freeCodeCamp/api
Oliver Eyton-Williams 5e17868c74
fix(api): allow fastify to set content-type dynamically (#50248)
fix: allow fastify to set content-type dynamically

We can set content-type: application/json for specific routes, but
doing so ends up with confusing, over-engineered code.

Instead we should take care when auditing the endpoints.
2023-05-02 10:15:31 -07:00
..
prisma feat(api): add prisma as orm (#49413) 2023-03-14 17:29:55 +00:00
src fix(api): allow fastify to set content-type dynamically (#50248) 2023-05-02 10:15:31 -07:00
tools feat(api): add prisma as orm (#49413) 2023-03-14 17:29:55 +00:00
.gitignore chore(api): compile TS into /dist (#49812 2023-03-28 19:42:20 +05:30
jest.config.ts feat(api): add CORS headers (#50120) 2023-04-26 09:02:12 +02:00
jest.utils.ts feat(api): add CORS headers (#50120) 2023-04-26 09:02:12 +02:00
package.json refactor(api): remove unused endpoints (#50252) 2023-05-02 19:54:05 +03:00
README.md feat(api): dev login (#49880) 2023-03-29 18:08:38 +05:30
tsconfig.build.json chore(api): compile TS into /dist (#49812 2023-03-28 19:42:20 +05:30
tsconfig.json chore(api): compile TS into /dist (#49812 2023-03-28 19:42:20 +05:30

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.