[QOTD-2] Initialise npm project and install dependencies
- npm init with express (prod) and typescript, ts-node, @types/express, @types/node, eslint, @typescript-eslint/parser, @typescript-eslint/eslint-plugin, vitest (dev) - Add .gitignore excluding node_modules/ and dist/ - Add CLAUDE.md documenting chosen stack, commands, and project structure Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e4ac0430ce
commit
9d60f0708c
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
68
CLAUDE.md
Normal file
68
CLAUDE.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# 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 (to be created)
|
||||||
|
├── dist/ # compiled output (git-ignored)
|
||||||
|
├── package.json
|
||||||
|
├── package-lock.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
|
||||||
|
|
||||||
|
> Update this section once a linter/formatter config is committed (`.eslintrc`, etc.).
|
||||||
|
|
||||||
|
- **TypeScript**: `strict: true`, `target: "ES2020"` recommended in `tsconfig.json`
|
||||||
|
- **Linting**: ESLint with `@typescript-eslint` rules; `npm run lint` must exit cleanly
|
||||||
|
- 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.
|
||||||
3523
package-lock.json
generated
Normal file
3523
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
32
package.json
Normal file
32
package.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "quote-of-the-day-api",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"dev": "ts-node src/index.ts",
|
||||||
|
"test": "vitest run",
|
||||||
|
"test:watch": "vitest"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitea-ai-sdlc.scopicdev.com/scopic-software/quote-of-the-day-api.git"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^5.2.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/express": "^5.0.6",
|
||||||
|
"@types/node": "^26.1.1",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^8.64.0",
|
||||||
|
"@typescript-eslint/parser": "^8.64.0",
|
||||||
|
"eslint": "^10.7.0",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
|
"typescript": ">=5.0.0 <6.1.0",
|
||||||
|
"vitest": "^4.1.10"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user