apps/api/v2/README.md
Cal.com api v2 is a Nest.js project.
This setup will allow you to develop with api v2 locally. If you want to also test atoms locally with platform's example app,
then proceed to apps/api/v2/README-PLATFORM.md instead.
$ yarn install
$ cd packages/emails && yarn dx
apps/api/v2/.env.example and rename it to apps/api/v2/.env - it has almost all the required values setup - ones you need to add will be explained below.NEXTAUTH_SECRET from there to the root .env NEXTAUTH_SECRET. If you have NEXTAUTH_SECRET already in the root .env then you can paste that value in apps/api/v2/.env.Note: make sure that the value of `NEXTAUTH_SECRET` is the same in both the root `.env` and in the api v2 `.env`.
id, logo, theme, licenseKey, agreedLicenseAt:-
1, null, null, '00000000-0000-0000-0000-000000000000', '2023-05-15 21:39:47.611'
Then in the apps/api/v2/.env set the license key environment variable:
CALCOM_LICENSE_KEY="00000000-0000-0000-0000-000000000000"
$ cd packages/prisma
$ yarn prisma generate
$ yarn prisma migrate dev
$ yarn db-seed
Start api v2 using:
$ yarn dev
Sometimes it happens that v2 api restarts because some unrelated log of build files changed if you are running it while cal web app is running. If it happens and is annoying you, you can just build it and then run without watch mode:
cd apps/api/v2
yarn dev:build
yarn start
Api v2 depends on various platform packages "platform-libraries, platform-constants, platform-enums, platform-utils, platform-types" so if any of them change you might need to restart api v2 so it rebuild these dependencies and picks up the changes.
Notably, you can run following command(in different terminal) to ensure that any change in any of the dependencies is rebuilt and detected. It watches platform-libraries, platform-constants, platform-enums, platform-utils, platform-types.
$ yarn run dev:build:watch
OR if you don't want to use docker, you can run following command.
$ yarn dev:no-docker
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# run specific e2e test file in watch mode
$ yarn run test:e2e some-file.e2e-spec.ts
# test coverage
$ yarn run test:cov
@ApiAuthGuardOnlyAllow(["API_KEY"]) under the @UseGuards(ApiAuthGuard). Shortly, use ApiAuthGuardOnlyAllow to specify which auth methods are allowed by ApiAuthGuard. If ApiAuthGuardOnlyAllow is not used or nothing is passed to it or empty array it means that
all auth methods are allowed.