aws / aws/graph-explorer

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

Open
#1,621 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
481
Forks
108
Avg merge
6d 8h
Merged PRs (30d)
5

Description

## Parent PRD

- Parent #1618

## 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

- Blocked by #1619

## User stories addressed

- User story 8
- User story 12

Contributor guide

Open the contributing guide

Research direction

After the dependency on #1619 is resolved, locate the apiBase module, _gremlinFetch, _sparqlFetch, _openCypherFetch, summary endpoint code, and the Vite dev server proxy configuration. Read the existing request and proxy tests first, then verify default and prefixed BASE_URL behavior, apiBase-derived request URLs, and the simplified /api proxy rule.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
api, build-system, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
60/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.