# @echelon-framework/mock-server

Standalone Node.js mock backend for Echelon — HTTP REST + WebSocket streams. Zero config, fixture-based.

Part of the **Echelon Framework** — Angular-based, config-driven dashboard & low-code platform.

## Installation

```bash
npm install -D @echelon-framework/mock-server
```

## Usage

```bash
npx echelon-mock-server --config mock-server.json
# → HTTP: http://127.0.0.1:3001/api/:resource
# → WS:   ws://127.0.0.1:3001/ws
```

## Configuration (mock-server.json)

```json
{
  "port": 3001,
  "host": "127.0.0.1",
  "responses": {
    "health": { "status": "ok" },
    "clients": "@file:src/assets/fixtures/clients.json",
    "positions": [{ "id": "POS-001", "pair": "USDPLN", "amount": 100000 }]
  },
  "streams": {
    "rates.usdpln": {
      "simulate": {
        "kind": "fx-random-walk",
        "mid": 4.05,
        "vol": 0.0003,
        "intervalMs": 600
      }
    }
  }
}
```

## Features

- **GET /api/:resource** — returns fixture from `responses[resource]`
- **@file:** prefix — loads JSON from file (`@file:path/to/data.json`)
- **WebSocket streams** — simulators (fx-random-walk, sine, random-int)
- **CORS enabled** — works with `ng serve` proxy or direct
- **Hot reload** — watches config file for changes

## License

BUSL-1.1
