Skip to content

refactor(api): standardize public route casing on lowercase#34

Merged
sidhujag merged 1 commit intomasterfrom
refactor/api-lowercase-canonical
Apr 26, 2026
Merged

refactor(api): standardize public route casing on lowercase#34
sidhujag merged 1 commit intomasterfrom
refactor/api-lowercase-canonical

Conversation

@sidhujag
Copy link
Copy Markdown
Member

Summary

Companion to syscoin/sysnode-backend#23. The historical canonical URL for the public sysnode-backend endpoints is lowercase — syshub still calls https://syscoin.dev/mnstats lowercase, and /govlist was already lowercase. The camelCase only appeared because the backend route files registered router.get("/mnStats", …); Express's default case-insensitive routing hid the drift across both ends.

This pins the SPA on the lowercase canonical so future readers and external integrators see one consistent shape.

  • src/lib/api.js: client.get('/mnstats'), client.get('/mncount').
  • README.md data-source layout block updated.
  • Comments in NewProposal.{js,test.js} and governanceWindow.{js,test.js} refreshed to use the lowercase path names.

Backwards compatibility

The backend's case-insensitive default routing AND the case-insensitive ~* regex match in the bundled nginx example (sysnode-backend#23) mean any in-flight SPA build still using camelCase keeps working during a rolling deploy. New code paths land on lowercase from the start.

Test plan

  • CI=true npm test -- --watchAll=false (880/880 pass)
  • CI green on this PR
  • Deploy ordering on the live box: live nginx updated to case-insensitive regex (mirror of sysnode-backend example) → backend pulled+restart → SPA pulled+rebuilt+restart. With nginx case-insensitive, any combination of old/new SPA + old/new backend works.
  • Manual smoke after deploy: load https://sysnode.dev11.top/, confirm dashboard stats render and the network status block populates (proves /mnstats lookup succeeded same-origin).

Made with Cursor

Companion to syscoin/sysnode-backend#23. The historical canonical URL
for the public sysnode-backend endpoints is lowercase: syshub still
calls `https://syscoin.dev/mnstats` lowercase, and `/govlist` was
already lowercase. The camelCase only appeared because the backend
route files registered `router.get("/mnStats", …)`; Express's default
case-insensitive routing hid the drift across both ends.

Pin the SPA on the lowercase canonical so future readers and external
integrators see one consistent shape:

- src/lib/api.js: client.get('/mnstats'), client.get('/mncount').
- README data-source layout block updated.
- Comments in NewProposal.{js,test.js} and governanceWindow.{js,test.js}
  refreshed to use the lowercase path names. (Behaviourally these are
  documentation refs; the request URL change is in api.js.)

Backwards compat: the backend's case-insensitive default routing AND
the case-insensitive `~*` regex match in the bundled nginx example
(syscoin/sysnode-backend#23) mean any in-flight build still using
camelCase keeps working during a rolling deploy. New code paths land
on lowercase from the start.

880 jest tests pass.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ 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".

@sidhujag sidhujag merged commit 0ae6bc1 into master Apr 26, 2026
4 checks passed
@sidhujag sidhujag deleted the refactor/api-lowercase-canonical branch April 26, 2026 00:07
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