How harshsri28/crypto-exchange works
Project type and purpose
• This is a stateless backend microservice (“Crypto API”) built on Node.js/Express.
• Purpose: expose two HTTP endpoints (/getTop100 and /currencyConvertor) that fetch data from an external cryptocurrency data provider (e.g., CoinGecko) and return results to clients.
File structure
• config/
– development.json: environment-specific settings (e.g., API URLs, ports).
– winstonConfig.js: centralized logging setup using Winston.
• index.js
– Entry point: loads configuration, instantiates Express app, applies middleware (logger, JSON parsing), mounts routes, and starts HTTP server.
• src/routes.js
– Defines Express routes and maps HTTP methods + paths to controller functions.
• src/controllers/cryptoController.js
– Controller layer: validates request payload, calls service layer, and formats HTTP responses.
• src/services/cryptoService.js
– Business‐logic layer: constructs and issues HTTP requests to the external crypto API, processes raw data, and returns normalized objects.
• src/utils/constants.js
– Shared constants (e.g., endpoint paths, default currency codes).
• package.json / package-lock.json
– Lists dependencies (Express, Axios or node-fetch, Winston, etc.) and scripts.
Extract architecture hints from README
• Two REST GET endpoints with JSON requests & responses.
• No internal database—data is proxied/transformed from an external service.
• Logging and environment configuration are central cross‐cutting concerns.
Key reminders
• Be thorough: include every major piece (index.js startup, config injection, routes, controllers, services, external API).
• Use consistent naming from the codebase (e.g., “cryptoController”, “cryptoService”).