A lightweight Express server that streams simulated real-time stock price updates over Server-Sent Events (SSE).
Exposes a single endpoint GET /prices that:
- Immediately sends a snapshot of all 10 stock prices (AAPL, MSFT, GOOGL, AMZN, TSLA, META, NVDA, JPM, BAC, GS)
- Continuously streams random price updates — 1–4 symbols per tick, every 300–1500 ms
Each SSE message is a JSON array of { symbol, price } objects.
pnpm install# Development (watch mode)
pnpm dev
# Production
pnpm startThe server listens on http://localhost:3000.
Connect any SSE client to http://localhost:3000/prices:
const source = new EventSource('http://localhost:3000/prices');
source.onmessage = ({ data }) => console.log(JSON.parse(data));