How neylanio/gostack_challenge2-nodejs works
This is a small Express transaction API. Requests enter through the server and app, then reach transaction routes for listing, creating, or updating records. The repository keeps transactions in memory and calculates income, outcome, and total balances; services validate transaction types and prevent outcomes exceeding the current balance. The graph follows relationships shown in the sampled source and README; persistence is in-memory, and no external storage is shown.
Main entry points: transaction.routes.ts Transaction routes · TransactionsRepository.ts Transaction repository · app.ts Express app · index.ts Route registry
Components 9
HTTP runtime
- HTTP server
src/server.ts - Express app
src/app.ts - Route registry
src/routes/index.ts - Transaction routes
src/routes/transaction.routes.ts
Transaction domain
- Create service
src/services/CreateTransactionService.ts - Update service
src/services/UpdateTransactionService.ts - Transaction model
src/models/Transaction.ts
In-memory data
- Transaction repository
src/repositories/TransactionsRepository.ts
Other components
- API client
Connections 10
- API client → Express app: sends requests
README.md - HTTP server → Express app: starts
src/server.ts - Express app → Route registry: mounts
src/app.ts - Route registry → Transaction routes: mounts
src/routes/index.ts - Transaction routes → Transaction repository: lists and reads balance
src/routes/transaction.routes.ts - Transaction routes → Create service: executes create
src/routes/transaction.routes.ts - Transaction routes → Update service: executes update
src/routes/transaction.routes.ts - Create service → Transaction repository: checks and creates
src/services/CreateTransactionService.ts - Update service → Transaction repository: checks and updates
src/services/UpdateTransactionService.ts - Transaction repository → Transaction model: constructs records
src/repositories/TransactionsRepository.ts