mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
62 lines
2.3 KiB
Markdown
62 lines
2.3 KiB
Markdown
# Next Steps to Complete REST API
|
|
|
|
## Current Situation
|
|
The REST API implementation (`index.js`) doesn't match its specification:
|
|
- Uses "items" instead of "tasks"
|
|
- Missing API versioning (`/api/v1/`)
|
|
- Lacks proper data model (timestamps, completed field)
|
|
- No test suite with Jest/Supertest
|
|
|
|
## Immediate Action Required
|
|
|
|
### Option 1: Sequential SPARC Execution (Recommended)
|
|
Execute the following command to start the refactoring:
|
|
|
|
```bash
|
|
cd /workspaces/claude-code-flow/examples/rest-api-simple
|
|
npx claude-flow sparc run code "Refactor index.js to server.js for REST API: change resource from items to tasks, add API versioning /api/v1/, update data model with title/completed/timestamps"
|
|
```
|
|
|
|
Then continue with:
|
|
1. `npx claude-flow sparc run tdd "Create Jest test suite for tasks REST API"`
|
|
2. `npx claude-flow sparc run code "Implement query parameters for tasks API"`
|
|
3. `npx claude-flow sparc run code "Enhance error handling for tasks API"`
|
|
|
|
### Option 2: Parallel Swarm Execution (Faster)
|
|
Use swarm mode to complete everything at once:
|
|
|
|
```bash
|
|
cd /workspaces/claude-code-flow/examples/rest-api-simple
|
|
npx claude-flow swarm "Complete REST API implementation: refactor to tasks resource with proper data model, add API versioning, create Jest test suite, implement query parameters, enhance error handling" \
|
|
--strategy development \
|
|
--background \
|
|
--parallel \
|
|
--testing
|
|
```
|
|
|
|
### Option 3: Manual Implementation
|
|
1. Backup current implementation: `cp index.js index.js.backup`
|
|
2. Install test dependencies: `npm install --save-dev jest supertest`
|
|
3. Manually refactor the code following the architecture plan
|
|
4. Create test suite
|
|
5. Run tests: `npm test`
|
|
|
|
## Key Files to Review
|
|
- `architecture-completion-plan.md` - Detailed technical architecture
|
|
- `sparc-implementation-roadmap.md` - Step-by-step SPARC commands
|
|
- `api-specification.md` - Target API specification
|
|
|
|
## Expected Outcome
|
|
After completion, the API will:
|
|
- Use `/api/v1/tasks` endpoints
|
|
- Support task model with `title`, `completed`, `createdAt`, `updatedAt`
|
|
- Include query parameters for filtering and pagination
|
|
- Have comprehensive Jest test suite
|
|
- Match the documented specification exactly
|
|
|
|
## Time Estimate
|
|
- Sequential SPARC: ~80 minutes
|
|
- Parallel Swarm: ~30 minutes
|
|
- Manual: 2-3 hours
|
|
|
|
Choose your preferred approach and execute the commands above to complete the REST API implementation. |