Add eslint.config.mjs (flat config) using @typescript-eslint/eslint-plugin flat/recommended rules. Add npm run lint script (exits 0 on current codebase). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
70 lines
1.9 KiB
Markdown
70 lines
1.9 KiB
Markdown
# quote-of-the-day-api
|
|
|
|
A REST API that serves a daily rotating quote. Built with Node.js, Express, and TypeScript.
|
|
|
|
## Build Commands
|
|
|
|
```bash
|
|
# Install dependencies (NODE_ENV=production requires --include=dev)
|
|
npm install --include=dev
|
|
|
|
# Build TypeScript → dist/
|
|
npm run build
|
|
```
|
|
|
|
## Test Commands
|
|
|
|
```bash
|
|
# Run full test suite
|
|
npm test
|
|
|
|
# Watch mode
|
|
npm run test:watch
|
|
|
|
# Run a single test file
|
|
npx vitest run path/to/file.test.ts
|
|
|
|
# Run a single named test
|
|
npx vitest run -t "test name here"
|
|
```
|
|
|
|
## Development Commands
|
|
|
|
```bash
|
|
# Start local dev server
|
|
npm run dev
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
quote-of-the-day-api/
|
|
├── src/ # TypeScript source
|
|
│ └── placeholder.test.ts # harness smoke test
|
|
├── dist/ # compiled output (git-ignored)
|
|
├── eslint.config.mjs # ESLint flat config (@typescript-eslint recommended)
|
|
├── package.json
|
|
├── package-lock.json
|
|
├── tsconfig.json
|
|
├── .gitignore
|
|
├── README.md # Project overview (currently a stub)
|
|
└── CLAUDE.md # This file
|
|
```
|
|
|
|
> Update this section as source directories are added.
|
|
|
|
## Architecture Notes
|
|
|
|
- **Purpose**: Serve a quote of the day via a REST API, rotating through a collection of quotes.
|
|
- **Expected endpoints**: `GET /quote` — returns today's quote (deterministic per calendar day), `GET /quotes` — list all available quotes.
|
|
- **Runtime**: Node.js 22 / Express 5 / TypeScript 5.x (pinned `>=5.0.0 <6.1.0`)
|
|
- **Test framework**: Vitest 4.x
|
|
- **Linter**: ESLint 10 + @typescript-eslint 8
|
|
|
|
## Code Style
|
|
|
|
- **TypeScript**: `strict: true`, `target: "ES2020"` in `tsconfig.json`
|
|
- **Linting**: ESLint 10 flat config (`eslint.config.mjs`) using `@typescript-eslint/eslint-plugin` `flat/recommended` rules; run `npm run lint` — must exit 0
|
|
- Follow the conventions of the chosen language's ecosystem formatter (e.g., Prettier for JS/TS).
|
|
- Keep controllers thin; put business logic in service or domain layers.
|