Skip to content

fix: added local k8s config file, changed client to integrate with the gateway and added cors support#6

Merged
anshggss merged 1 commit into
mainfrom
amt/corsSupport
Jun 29, 2026
Merged

fix: added local k8s config file, changed client to integrate with the gateway and added cors support#6
anshggss merged 1 commit into
mainfrom
amt/corsSupport

Conversation

@anshggss

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings June 29, 2026 10:38
@anshggss anshggss merged commit 3a8cbd6 into main Jun 29, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the BoxGame deployment and client/server integration to route room assignment through the gateway, adds a local Kubernetes overrides manifest, and introduces CORS middleware to enable browser-based requests that rely on cookies.

Changes:

  • Added cors support to gateway and server-manager Express apps.
  • Refactored the browser client to call gateway HTTP endpoints (/createRoom, /add) to obtain the assigned game-server, then connect Socket.IO directly to that server.
  • Added k8s.local.yaml for minikube/local image overrides and adjusted parts of the base k8s.yaml.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
server-manager/package.json Adds cors and @types/cors dependencies.
server-manager/index.ts Registers CORS middleware for server-manager API.
server-manager/bun.lock Locks newly added CORS dependencies.
k8s.yaml Updates gateway replica count; removes a readinessProbe block (per diff).
k8s.local.yaml Adds local/minikube overrides for images and env vars.
gateway/routes/addToRoom.ts Changes room lookup to query-string roomID and aligns cookie names with createRoom.
gateway/package.json Adds cors and @types/cors dependencies.
gateway/index.ts Registers CORS middleware on the gateway.
gateway/bun.lock Locks newly added CORS dependencies.
client/index.js Uses gateway HTTP endpoints + cookies to discover assigned game-server; creates sockets lazily per assignment.
client/index.html Injects window.GATEWAY_URL configuration for the client runtime.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client/index.js
Comment on lines +2 to +6
// GATEWAY_URL is injected by index.html as a <script> block so it works
// both locally and on Vercel without a bundler.
// Locally: window.GATEWAY_URL = "http://localhost:3000"
// Vercel: window.GATEWAY_URL = "https://<your-vm-ip-or-domain>"
const GATEWAY_URL = window.GATEWAY_URL || "http://localhost:3000";
Comment on lines +11 to 13
// Use the same cookie names as createRoom so the client's getCookie() works
res.cookie("hostIp", roomMaps[roomId]["hostIp"]);
res.cookie("port", roomMaps[roomId]["port"]);
Comment thread k8s.yaml
Comment on lines 157 to 159
spec:
replicas: 2
replicas: 1
selector:
Comment thread gateway/index.ts
Comment on lines +8 to +13
app.use(
cors({
origin: "http://localhost:3000",
credentials: true,
}),
);
Comment thread server-manager/index.ts
Comment on lines +10 to +14
app.use(
cors({
credentials: true,
}),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants