freeCodeCamp/api
Oliver Eyton-Williams 71d5a67745
feat(api): add security headers (#49995)
* feat(api): add security headers

Includes the OWASP recommended headers for REST APIs. Taken from
https://cheatsheetseries.owasp.org/cheatsheets/REST_Security_Cheat_Sheet.html#security-headers

* test: check OWASP headers appear on GET / request

* fix: only enable Strict-Transport-Security in prod
2023-04-13 10:16:58 +02:00
..
prisma feat(api): add prisma as orm (#49413) 2023-03-14 17:29:55 +00:00
src feat(api): add security headers (#49995) 2023-04-13 10:16:58 +02: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): setup jest in new api (#49709) 2023-03-16 20:33:40 +05:30
package.json fix(deps): update prisma monorepo to v4.12.0 (#50018) 2023-04-10 19:26:23 +05:30
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.