Description
The backend route src/routes/apis.ts currently returns a hard-coded { apis: [] } placeholder regardless of state. This backend task replaces it with a real listing endpoint that reads from the Drizzle apis table (src/db/schema.ts) and joins endpoint pricing so the marketplace can render registered APIs. It matters because the API marketplace cannot surface any catalog data until this endpoint is real.
Requirements and Context
- Replace the placeholder handler in
src/routes/apis.ts with a query against the apis table defined in src/db/schema.ts.
- Only return APIs with
status = 'active' by default; allow ?status= filtering against apiStatusEnum.
- Use
parsePagination/paginatedResponse from src/lib/pagination.ts for limit/offset.
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/apis-listing-endpoint
- Implement changes
src/routes/apis.ts — wire the route to a repository read
src/repositories/apiRepository.ts — add a paginated list query
- Map DB rows to the public
ApisResponse shape in src/types/index.ts
- Test and commit
npm test -- src/data/apiRegistry.test.ts src/repositories/apiRepository.test.ts
- Cover edge cases
- Include test output and notes in the PR
Example commit message
feat: back GET /api/apis with the Drizzle apis table
Acceptance Criteria
Guidelines
- Minimum 90% test coverage with Jest; validate inputs and handle errors via
src/errors
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
The backend route
src/routes/apis.tscurrently returns a hard-coded{ apis: [] }placeholder regardless of state. This backend task replaces it with a real listing endpoint that reads from the Drizzleapistable (src/db/schema.ts) and joins endpoint pricing so the marketplace can render registered APIs. It matters because the API marketplace cannot surface any catalog data until this endpoint is real.Requirements and Context
src/routes/apis.tswith a query against theapistable defined insrc/db/schema.ts.status = 'active'by default; allow?status=filtering againstapiStatusEnum.parsePagination/paginatedResponsefromsrc/lib/pagination.tsfor limit/offset.Suggested Execution
src/routes/apis.ts— wire the route to a repository readsrc/repositories/apiRepository.ts— add a paginatedlistqueryApisResponseshape insrc/types/index.tsnpm test -- src/data/apiRegistry.test.ts src/repositories/apiRepository.test.tsExample commit message
Acceptance Criteria
GET /api/apisreturns active APIs from the database with pagination metadata?status=filtering validates againstapiStatusEnumand rejects unknown values with 400Guidelines
src/errors