Skip to content

Enhance server functionality to serve static files and add production start command#69

Merged
manix84 merged 1 commit into
mainfrom
bug/backend-update
May 23, 2026
Merged

Enhance server functionality to serve static files and add production start command#69
manix84 merged 1 commit into
mainfrom
bug/backend-update

Conversation

@manix84
Copy link
Copy Markdown
Owner

@manix84 manix84 commented May 23, 2026

This pull request introduces a production-ready server setup that allows the built game, Storybook showcase, and high-score API to be served together from a single DigitalOcean web service. The main changes focus on adding static file serving to the existing API server, updating documentation, and incrementing the package version.

Production server enhancements:

  • Added a new npm start script to package.json that runs the unified production server (server/high-score-server.mjs).
  • The server now serves static files from the built dist/ directory, including game assets and Storybook, alongside the /api/high-scores endpoint. Static routing supports clean URLs for main routes and assets. [1] [2] [3] [4]

Documentation updates:

  • Updated README.md with instructions for deploying the unified server on DigitalOcean, clarifying that both the game and API are now served from the same process.
  • Added a changelog entry in WHATSNEW.md describing the new production server capability.

Other changes:

  • Bumped the project version to 22.13.0 to reflect the new features.

Copilot AI review requested due to automatic review settings May 23, 2026 01:11
@manix84 manix84 enabled auto-merge (squash) May 23, 2026 01:11
@manix84 manix84 merged commit 3c24f7b into main May 23, 2026
4 of 5 checks passed
@manix84 manix84 deleted the bug/backend-update branch May 23, 2026 01:13
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3e187dc14

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +485 to +486
filePath.includes(`${sep}assets${sep}`)
? "public, max-age=31536000, immutable"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid immutable cache for non-fingerprinted assets

This marks every file under /assets/ as public, max-age=31536000, immutable, but this repo’s Vite output uses stable names like assets/app.js and assets/app.css (see vite.config.ts output naming). Because those filenames do not change per release, browsers can keep old bundles for up to a year, so users may continue running stale code after deployment unless they hard-refresh. Either fingerprint asset filenames or use a shorter/non-immutable cache policy for these files.

Useful? React with 👍 / 👎.


const getStaticFilePath = (requestUrl) => {
const url = new URL(requestUrl, "http://localhost");
const pathname = decodeURIComponent(url.pathname);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard decodeURIComponent failures in static path parsing

decodeURIComponent(url.pathname) can throw URIError on malformed percent-encoded paths (for example, /%E0%A4%A). Since this happens before the local try block in handleStaticRequest, it falls through to the outer server catch and returns a 500 server_error instead of a client error, which is both incorrect behavior and easy for scanners to trigger repeatedly. Treat decode failures as a 400/404 in getStaticFilePath.

Useful? React with 👍 / 👎.

@manix84 manix84 review requested due to automatic review settings May 23, 2026 01:34
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.

1 participant