Skip to content

Scheduling infrastructure for absolutely everyone.

chore: rewrite api.cal.com/v2 to api v2 (#14285)

Morganf8cbf8b1c463
diff --git a/.github/workflows/production-build-without-database.yml b/.github/workflows/production-build-without-database.yml
index 40c05b0e92f..2542c1c6809 100644
--- a/.github/workflows/production-build-without-database.yml
+++ b/.github/workflows/production-build-without-database.yml
@@ -30,6 +30,8 @@ env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
NEXT_PUBLIC_API_V2_URL: ${{ secrets.CI_NEXT_PUBLIC_API_V2_URL }}
+ NEXT_PUBLIC_API_V2_ROOT_URL: ${{ secrets.CI_NEXT_PUBLIC_API_V2_ROOT_URL }}
+
jobs:
build:
diff --git a/.github/workflows/production-build.yml b/.github/workflows/production-build.yml
index 3f58b9c6374..061ebcf8ca1 100644
--- a/.github/workflows/production-build.yml
+++ b/.github/workflows/production-build.yml
@@ -34,6 +34,8 @@ env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
NEXT_PUBLIC_API_V2_URL: ${{ secrets.CI_NEXT_PUBLIC_API_V2_URL }}
+ NEXT_PUBLIC_API_V2_ROOT_URL: ${{ secrets.CI_NEXT_PUBLIC_API_V2_ROOT_URL }}
+
jobs:
build:
diff --git a/apps/api/v1/.env.example b/apps/api/v1/.env.example
index c5354bfd7da..37b43dd5574 100644
--- a/apps/api/v1/.env.example
+++ b/apps/api/v1/.env.example
@@ -4,3 +4,4 @@ NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000
# Get it in console.cal.com
CALCOM_LICENSE_KEY=""
+NEXT_PUBLIC_API_V2_ROOT_URL=http://localhost:5555
\ No newline at end of file
diff --git a/apps/api/v1/next.config.js b/apps/api/v1/next.config.js
index 4d861ce3c30..d875b8169c8 100644
--- a/apps/api/v1/next.config.js
+++ b/apps/api/v1/next.config.js
@@ -47,6 +47,22 @@ const nextConfig = {
source: "/v:version/:rest*",
destination: "/api/v:version/:rest*",
},
+ {
+ source: "/api/v2",
+ destination: `${process.env.NEXT_PUBLIC_API_V2_ROOT_URL}/health`,
+ },
+ {
+ source: "/api/v2/health",
+ destination: `${process.env.NEXT_PUBLIC_API_V2_ROOT_URL}/health`,
+ },
+ {
+ source: "/api/v2/docs/:path*",
+ destination: `${process.env.NEXT_PUBLIC_API_V2_ROOT_URL}/docs/:path*`,
+ },
+ {
+ source: "/api/v2/:path*",
+ destination: `${process.env.NEXT_PUBLIC_API_V2_ROOT_URL}/api/v2/:path*`,
+ },
// This redirects requests to api/v*/ to /api/ passing version as a query parameter.
{
source: "/api/v:version/:rest*",
diff --git a/turbo.json b/turbo.json
index ba7e34058e9..bb590849e4d 100644
--- a/turbo.json
+++ b/turbo.json
@@ -399,6 +399,7 @@
"EMBED_PUBLIC_VERCEL_URL",
"NEXT_PUBLIC_ENABLE_PROFILE_SWITCHER",
"NEXT_PUBLIC_HEAD_SCRIPTS",
- "NEXT_PUBLIC_BODY_SCRIPTS"
+ "NEXT_PUBLIC_BODY_SCRIPTS",
+ "NEXT_PUBLIC_API_V2_ROOT_URL"
]
}