# Changelog

## Merged server.js changes (added BnB Companion endpoints)

- Added `BxBHostInfo` output directory and helper `ensureOutputDir()`.
- Added basic CORS middleware to support the compatibility endpoints.
- Added endpoints:
  - `GET /exists?tvcode=...` — check if `<tvcode>.json` exists in `BxBHostInfo`.
  - `POST /save` — save JSON payload to an existing `<tvCode>.json` file (requires `tvCode` in payload).
  - `POST /create-empty` — create an empty template JSON file; supports `name` and `overwrite`.

How to run

1. Install dependencies: `npm install`
2. Start the server: `node server.js` (or set `PORT` to an available port)

Notes

- The server previously used port 3000 by default; if another process is listening on that port, set `PORT` env var or stop the other process.
- The changes preserve existing API routes and add the compatibility endpoints used by the BnB Companion HTTP client.

## Removed dotenv

- Removed `dotenv` usage — configuration should be provided via environment variables (e.g. set `OPENAI_API_KEY` and `PORT` in your environment) rather than loading a local `.env` file.
- If you used a `.env` file for local development, set variables in your shell before starting the server, for example:

```bash
export OPENAI_API_KEY="your_key_here"
export PORT=3101
node server.js
```

# Changelog

## Merged server.js changes (added BnB Companion endpoints)

- Added `BxBHostInfo` output directory and helper `ensureOutputDir()`.
- Added basic CORS middleware to support the compatibility endpoints.
- Added endpoints:
  - `GET /exists?tvcode=...` — check if `<tvcode>.json` exists in `BxBHostInfo`.
  - `POST /save` — save JSON payload to an existing `<tvCode>.json` file (requires `tvCode` in payload).
  - `POST /create-empty` — create an empty template JSON file; supports `name` and `overwrite`.

How to run

1. Install dependencies: `npm install`
2. Start the server: `node server.js` (or set `PORT` to an available port)

Notes

- The server previously used port 3000 by default; if another process is listening on that port, set `PORT` env var or stop the other process.
- The changes preserve existing API routes and add the compatibility endpoints used by the BnB Companion HTTP client.
