Skip to content

Create apiBase module and wire client fetch to /api/* #1621

@kmcginnes

Description

@kmcginnes

Parent PRD

What to build

Create a new module exporting an apiBase constant computed from import.meta.env.BASE_URL. Update all explorer fetch functions (_gremlinFetch, _sparqlFetch, _openCypherFetch) and summary endpoints to use apiBase instead of connection.url. Update the Vite dev server proxy config to a single /api rule.

This is the core client-side change that decouples outbound requests from the connection URL.

Type: HITL — requires review before completion.

Acceptance criteria

  • New apiBase module exports a constant derived from BASE_URL
  • apiBase resolves to http://localhost/api/ for default BASE_URL of /
  • apiBase resolves correctly for prefixed BASE_URL (e.g., /proxy/9250/)
  • All explorer fetch functions use apiBase for request URLs
  • Summary endpoints use apiBase for request URLs
  • Vite dev proxy config simplified to "/api": { target: expressServerUrl }
  • Tests verify apiBase computation for default and prefixed BASE_URL
  • Tests verify explorer fetch functions send requests to correct apiBase-derived URLs

Blocked by

User stories addressed

  • User story 8
  • User story 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions