@roomi-fields/grillhouse 0.0.0-stage → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +9 -0
- package/METACADRE.md +41 -0
- package/agents/developpeur.md +10 -0
- package/agents/explorateur.md +9 -0
- package/agents/questionneur.md +11 -0
- package/agents/referent-technique.md +9 -0
- package/agents/regulateur.md +11 -0
- package/agents/relecteur.md +9 -0
- package/agents/testwriter.md +10 -0
- package/bin/grillhouse.mjs +125 -0
- package/cadre/templates/projet/.claude/settings.json +30 -0
- package/cadre/templates/projet/.editorconfig +47 -0
- package/cadre/templates/projet/.env.example +57 -0
- package/cadre/templates/projet/.eslintrc.cjs +56 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +66 -0
- package/cadre/templates/projet/.mcp.json +13 -0
- package/cadre/templates/projet/.prettierrc +11 -0
- package/cadre/templates/projet/CHANGELOG.md +61 -0
- package/cadre/templates/projet/CLAUDE.md +46 -0
- package/cadre/templates/projet/CONTRIBUTING.md +243 -0
- package/cadre/templates/projet/CREDITS.md +41 -0
- package/cadre/templates/projet/README.md +152 -0
- package/cadre/templates/projet/_gitignore +91 -0
- package/cadre/templates/projet/_npmignore +46 -0
- package/cadre/templates/projet/deployment/README.md +98 -0
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +145 -0
- package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +117 -0
- package/cadre/templates/projet/deployment/docs/03-API.md +264 -0
- package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +262 -0
- package/cadre/templates/projet/deployment/scripts/install.ps1 +100 -0
- package/cadre/templates/projet/deployment/scripts/start.ps1 +61 -0
- package/cadre/templates/projet/deployment/scripts/stop.ps1 +37 -0
- package/cadre/templates/projet/deployment/scripts/test.ps1 +118 -0
- package/cadre/templates/projet/docs/agents/issue-tracker.md +44 -0
- package/cadre/templates/projet/ecosystem.config.cjs +73 -0
- package/cadre/templates/projet/package.json +90 -0
- package/cadre/templates/projet/pitmaster/SUIVI.md +22 -0
- package/cadre/templates/projet/src/config.ts +68 -0
- package/cadre/templates/projet/src/errors.ts +102 -0
- package/cadre/templates/projet/src/index.ts +46 -0
- package/cadre/templates/projet/src/services/.gitkeep +8 -0
- package/cadre/templates/projet/src/types/index.ts +24 -0
- package/cadre/templates/projet/src/utils/logger.ts +106 -0
- package/cadre/templates/projet/tests/integration/.gitkeep +7 -0
- package/cadre/templates/projet/tests/unit/config.spec.ts +68 -0
- package/cadre/templates/projet/tests/unit/errors.spec.ts +132 -0
- package/cadre/templates/projet/tests/unit/types.spec.ts +73 -0
- package/cadre/templates/projet/tsconfig.eslint.json +9 -0
- package/cadre/templates/projet/tsconfig.json +41 -0
- package/cadre/templates/projet/tsdoc.json +6 -0
- package/cadre/templates/projet/vitest.config.ts +44 -0
- package/cadre/templates/turbo/paquets.json +29 -0
- package/cadre/templates/turbo/sans-paquets.json +28 -0
- package/charte.md +107 -0
- package/docs/ARCHITECTURE.md +90 -0
- package/hooks/crochet.mjs +33 -0
- package/hooks/hooks.json +58 -0
- package/hooks/register.tsx +558 -0
- package/package.json +75 -4
- package/scripts/avancement.mjs +244 -0
- package/scripts/bilan.mjs +523 -0
- package/scripts/branche-de-nuit.mjs +59 -0
- package/scripts/cadre.mjs +109 -0
- package/scripts/circuit.mjs +4375 -0
- package/scripts/code-mort.mjs +371 -0
- package/scripts/composants-affectes.mjs +598 -0
- package/scripts/consommateurs-arbitres.mjs +192 -0
- package/scripts/consommateurs.mjs +310 -0
- package/scripts/crochet.mjs +24 -0
- package/scripts/crochets.mjs +135 -0
- package/scripts/dernier-vert.mjs +208 -0
- package/scripts/dette.mjs +181 -0
- package/scripts/droits.mjs +354 -0
- package/scripts/enveloppe/codes.mjs +17 -0
- package/scripts/enveloppe/composant.mjs +11 -0
- package/scripts/enveloppe/enveloppe.mjs +628 -0
- package/scripts/enveloppe/lancer.sh +311 -0
- package/scripts/etapes.mjs +323 -0
- package/scripts/etat-du-circuit.mjs +104 -0
- package/scripts/frontieres.mjs +456 -0
- package/scripts/gardes-du-cadre.mjs +72 -0
- package/scripts/greffons.mjs +338 -0
- package/scripts/grillhouse-maj.mjs +514 -0
- package/scripts/index-interfaces.mjs +293 -0
- package/scripts/init.mjs +117 -0
- package/scripts/integration/file-attente.mjs +61 -0
- package/scripts/integration/file.mjs +494 -0
- package/scripts/integration/integrer.mjs +381 -0
- package/scripts/integration/rejeu.mjs +139 -0
- package/scripts/integration/verdict.mjs +13 -0
- package/scripts/interfaces-contre-code.mjs +547 -0
- package/scripts/ligne-etat/defaut.sh +110 -0
- package/scripts/ligne-etat/ligne-etat.mjs +93 -0
- package/scripts/migrations/0.23.0-charte-importee.mjs +47 -0
- package/scripts/migrations/0.23.0-config-vitest.mjs +105 -0
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +55 -0
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +82 -0
- package/scripts/migrations.mjs +43 -0
- package/scripts/nuit.sh +269 -0
- package/scripts/paquets.mjs +79 -0
- package/scripts/poussee-cles.mjs +46 -0
- package/scripts/preparation.mjs +84 -0
- package/scripts/references-par-les-types.mjs +420 -0
- package/scripts/registre.mjs +336 -0
- package/scripts/resultats.mjs +580 -0
- package/scripts/resumes.mjs +57 -0
- package/scripts/retirer-copie.sh +127 -0
- package/scripts/session-start.sh +203 -0
- package/scripts/sortie.mjs +155 -0
- package/scripts/sous-modules.sh +316 -0
- package/scripts/structure-guard.sh +27 -0
- package/scripts/superviseur.mjs +102 -0
- package/scripts/tableau.mjs +1886 -0
- package/scripts/tests.mjs +236 -0
- package/scripts/ticket.sh +23 -0
- package/scripts/turbo-des-paquets.mjs +899 -0
- package/scripts/un-commit-par-ticket.mjs +212 -0
- package/scripts/verifier.mjs +469 -0
- package/scripts/verrou-de-fichier.mjs +130 -0
- package/scripts/verrou-de-machine.mjs +211 -0
- package/scripts/verrous/commande.mjs +180 -0
- package/scripts/verrous/ticket-du-sous-agent.mjs +39 -0
- package/scripts/verrous/verrou.mjs +165 -0
- package/scripts/vitest-config/avancement.mjs +39 -0
- package/scripts/vitest-config/avancement.reporter.mjs +56 -0
- package/scripts/vitest-config/base-de-passe.mjs +128 -0
- package/scripts/vitest-config/base.d.ts +6 -0
- package/scripts/vitest-config/base.mjs +87 -0
- package/scripts/vitest-config/changements.mjs +173 -0
- package/scripts/vitest-config/cibles.mjs +207 -0
- package/scripts/vitest-config/duree.reporter.mjs +98 -0
- package/scripts/vitest-config/machine.setup.mjs +14 -0
- package/scripts/vitest-config/mesure.d.ts +6 -0
- package/scripts/vitest-config/mesure.mjs +13 -0
- package/scripts/vitest-config/mesure.setup.mjs +12 -0
- package/scripts/vitest-config/pression.mjs +90 -0
- package/scripts/vitest-config/resultats.mjs +23 -0
- package/scripts/vitest-config/resultats.setup.mjs +19 -0
- package/scripts/vitest.nuit.config.mjs +26 -0
- package/skills/developpeur/SKILL.md +175 -0
- package/skills/explorateur/SKILL.md +84 -0
- package/skills/grill/SKILL.md +238 -0
- package/skills/grill/references/releve-structurel.md +38 -0
- package/skills/mesure/SKILL.md +168 -0
- package/skills/pitmaster/SKILL.md +382 -0
- package/skills/pitmaster/references/cadre.md +119 -0
- package/skills/pitmaster/references/consigne-agent.md +308 -0
- package/skills/pitmaster/references/erreurs.md +25 -0
- package/skills/pitmaster/references/tour.md +124 -0
- package/skills/questionneur/SKILL.md +64 -0
- package/skills/redacteur/SKILL.md +84 -0
- package/skills/redacteur/references/documents-d-un-composant.md +105 -0
- package/skills/referent-technique/SKILL.md +145 -0
- package/skills/regulateur/SKILL.md +220 -0
- package/skills/release/SKILL.md +134 -0
- package/skills/release/scripts/update-version.cjs +92 -0
- package/skills/relecteur/SKILL.md +152 -0
- package/skills/relecteur/references/LICENSE-MIT +30 -0
- package/skills/relecteur/references/SOURCE.md +8 -0
- package/skills/relecteur/references/claims-check.md +14 -0
- package/skills/relecteur/references/deletion-check.md +14 -0
- package/skills/relecteur/references/edge-case-hunter.md +80 -0
- package/skills/relecteur/references/verification-gap.md +113 -0
- package/skills/testwriter/SKILL.md +187 -0
- package/types/index.d.ts +56 -0
- package/README.md +0 -3
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Installation Guide
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- **Node.js**: Version 18.0.0 or higher
|
|
6
|
+
- **npm**: Comes with Node.js (or use yarn/pnpm)
|
|
7
|
+
- **Git**: For cloning the repository (if installing from source)
|
|
8
|
+
|
|
9
|
+
### Verify Prerequisites
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
node --version # Should be >= 18.0.0
|
|
13
|
+
npm --version # Should be >= 8.0.0
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Installation Methods
|
|
17
|
+
|
|
18
|
+
### Method 1: npm (Recommended)
|
|
19
|
+
|
|
20
|
+
Install globally:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g @your-scope/project-name
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or install locally in your project:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @your-scope/project-name
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Method 2: From Source
|
|
33
|
+
|
|
34
|
+
Clone and build:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Clone the repository
|
|
38
|
+
git clone https://github.com/your-username/project-name.git
|
|
39
|
+
cd project-name
|
|
40
|
+
|
|
41
|
+
# Install dependencies
|
|
42
|
+
npm install
|
|
43
|
+
|
|
44
|
+
# Build
|
|
45
|
+
npm run build
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Post-Installation
|
|
49
|
+
|
|
50
|
+
### 1. Create Configuration
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Copy example configuration
|
|
54
|
+
cp .env.example .env
|
|
55
|
+
|
|
56
|
+
# Edit with your settings
|
|
57
|
+
nano .env # or your preferred editor
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 2. Verify Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Check version
|
|
64
|
+
project-name --version
|
|
65
|
+
|
|
66
|
+
# Or run directly
|
|
67
|
+
npm start
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 3. Test the Application
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Run tests
|
|
74
|
+
npm test
|
|
75
|
+
|
|
76
|
+
# Check health endpoint (if applicable)
|
|
77
|
+
curl http://localhost:3000/health
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Updating
|
|
81
|
+
|
|
82
|
+
### npm Installation
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm update -g @your-scope/project-name
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Source Installation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git pull origin main
|
|
92
|
+
npm install
|
|
93
|
+
npm run build
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Uninstalling
|
|
97
|
+
|
|
98
|
+
### npm Installation
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm uninstall -g @your-scope/project-name
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Source Installation
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
rm -rf /path/to/project-name
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Troubleshooting Installation
|
|
111
|
+
|
|
112
|
+
### Permission Errors (npm global)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Option 1: Use sudo (Linux/macOS)
|
|
116
|
+
sudo npm install -g @your-scope/project-name
|
|
117
|
+
|
|
118
|
+
# Option 2: Fix npm permissions (recommended)
|
|
119
|
+
npm config set prefix ~/.npm-global
|
|
120
|
+
export PATH=~/.npm-global/bin:$PATH
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Build Errors
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Clear npm cache
|
|
127
|
+
npm cache clean --force
|
|
128
|
+
|
|
129
|
+
# Remove node_modules and reinstall
|
|
130
|
+
rm -rf node_modules package-lock.json
|
|
131
|
+
npm install
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Node Version Issues
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Using nvm to switch Node versions
|
|
138
|
+
nvm install 20
|
|
139
|
+
nvm use 20
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Next Steps
|
|
143
|
+
|
|
144
|
+
- [Configuration Guide](02-CONFIGURATION.md)
|
|
145
|
+
- [API Reference](03-API.md)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Configuration Guide
|
|
2
|
+
|
|
3
|
+
## Environment Variables
|
|
4
|
+
|
|
5
|
+
All configuration is done through environment variables. Create a `.env` file in the project root.
|
|
6
|
+
|
|
7
|
+
### Required Variables
|
|
8
|
+
|
|
9
|
+
| Variable | Description | Example |
|
|
10
|
+
|----------|-------------|---------|
|
|
11
|
+
| `NODE_ENV` | Environment mode | `production` |
|
|
12
|
+
|
|
13
|
+
### Optional Variables
|
|
14
|
+
|
|
15
|
+
| Variable | Description | Default |
|
|
16
|
+
|----------|-------------|---------|
|
|
17
|
+
| `PORT` | Server port | `3000` |
|
|
18
|
+
| `LOG_LEVEL` | Logging verbosity | `info` |
|
|
19
|
+
|
|
20
|
+
## Configuration File
|
|
21
|
+
|
|
22
|
+
### .env Template
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Environment
|
|
26
|
+
NODE_ENV=production
|
|
27
|
+
|
|
28
|
+
# Server
|
|
29
|
+
PORT=3000
|
|
30
|
+
|
|
31
|
+
# Logging
|
|
32
|
+
LOG_LEVEL=info
|
|
33
|
+
|
|
34
|
+
# Add your configuration here
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Environment-Specific Configuration
|
|
38
|
+
|
|
39
|
+
### Development
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
NODE_ENV=development
|
|
43
|
+
LOG_LEVEL=debug
|
|
44
|
+
PORT=3000
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Production
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
NODE_ENV=production
|
|
51
|
+
LOG_LEVEL=warn
|
|
52
|
+
PORT=8080
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Test
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
NODE_ENV=test
|
|
59
|
+
LOG_LEVEL=error
|
|
60
|
+
PORT=3001
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Advanced Configuration
|
|
64
|
+
|
|
65
|
+
### Logging Levels
|
|
66
|
+
|
|
67
|
+
| Level | Description | When to Use |
|
|
68
|
+
|-------|-------------|-------------|
|
|
69
|
+
| `debug` | Detailed debug info | Development |
|
|
70
|
+
| `info` | General information | Default |
|
|
71
|
+
| `warn` | Warning messages | Production |
|
|
72
|
+
| `error` | Error messages only | Minimal logging |
|
|
73
|
+
|
|
74
|
+
### PM2 Configuration
|
|
75
|
+
|
|
76
|
+
The `ecosystem.config.cjs` file configures PM2 daemon mode:
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
module.exports = {
|
|
80
|
+
apps: [{
|
|
81
|
+
name: 'project-name',
|
|
82
|
+
script: 'dist/index.js',
|
|
83
|
+
instances: 1,
|
|
84
|
+
autorestart: true,
|
|
85
|
+
max_memory_restart: '1G',
|
|
86
|
+
env: {
|
|
87
|
+
NODE_ENV: 'production',
|
|
88
|
+
PORT: 3000
|
|
89
|
+
}
|
|
90
|
+
}]
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Validation
|
|
95
|
+
|
|
96
|
+
Configuration is validated at startup. Invalid configuration will prevent the application from starting.
|
|
97
|
+
|
|
98
|
+
### Common Validation Errors
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Invalid environment configuration:
|
|
102
|
+
- PORT: Expected number, received string
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Solution**: Ensure all required variables are set with correct types.
|
|
106
|
+
|
|
107
|
+
## Security Considerations
|
|
108
|
+
|
|
109
|
+
1. **Never commit `.env` files** to version control
|
|
110
|
+
2. **Use strong secrets** in production
|
|
111
|
+
3. **Limit log verbosity** in production
|
|
112
|
+
4. **Rotate secrets** regularly
|
|
113
|
+
|
|
114
|
+
## Next Steps
|
|
115
|
+
|
|
116
|
+
- [API Reference](03-API.md)
|
|
117
|
+
- [Troubleshooting](04-TROUBLESHOOTING.md)
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Base URL: `http://localhost:3000`
|
|
6
|
+
|
|
7
|
+
All endpoints return JSON responses.
|
|
8
|
+
|
|
9
|
+
## Authentication
|
|
10
|
+
|
|
11
|
+
> Add authentication details here if applicable
|
|
12
|
+
|
|
13
|
+
## Endpoints
|
|
14
|
+
|
|
15
|
+
### Health Check
|
|
16
|
+
|
|
17
|
+
Check if the server is running.
|
|
18
|
+
|
|
19
|
+
**Request:**
|
|
20
|
+
```http
|
|
21
|
+
GET /health
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Response:**
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"status": "ok",
|
|
28
|
+
"version": "1.0.0",
|
|
29
|
+
"timestamp": "2024-01-01T00:00:00.000Z"
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**cURL Example:**
|
|
34
|
+
```bash
|
|
35
|
+
curl http://localhost:3000/health
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### Example Resource
|
|
41
|
+
|
|
42
|
+
#### List Resources
|
|
43
|
+
|
|
44
|
+
**Request:**
|
|
45
|
+
```http
|
|
46
|
+
GET /api/resources
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Query Parameters:**
|
|
50
|
+
| Parameter | Type | Description | Default |
|
|
51
|
+
|-----------|------|-------------|---------|
|
|
52
|
+
| `limit` | number | Max items to return | 10 |
|
|
53
|
+
| `offset` | number | Items to skip | 0 |
|
|
54
|
+
|
|
55
|
+
**Response:**
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"data": [
|
|
59
|
+
{
|
|
60
|
+
"id": "1",
|
|
61
|
+
"name": "Resource 1"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"total": 100,
|
|
65
|
+
"limit": 10,
|
|
66
|
+
"offset": 0
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**cURL Example:**
|
|
71
|
+
```bash
|
|
72
|
+
curl "http://localhost:3000/api/resources?limit=10&offset=0"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
#### Get Resource by ID
|
|
78
|
+
|
|
79
|
+
**Request:**
|
|
80
|
+
```http
|
|
81
|
+
GET /api/resources/:id
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Path Parameters:**
|
|
85
|
+
| Parameter | Type | Description |
|
|
86
|
+
|-----------|------|-------------|
|
|
87
|
+
| `id` | string | Resource ID |
|
|
88
|
+
|
|
89
|
+
**Response:**
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"id": "1",
|
|
93
|
+
"name": "Resource 1",
|
|
94
|
+
"createdAt": "2024-01-01T00:00:00.000Z"
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**cURL Example:**
|
|
99
|
+
```bash
|
|
100
|
+
curl http://localhost:3000/api/resources/1
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
#### Create Resource
|
|
106
|
+
|
|
107
|
+
**Request:**
|
|
108
|
+
```http
|
|
109
|
+
POST /api/resources
|
|
110
|
+
Content-Type: application/json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Body:**
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"name": "New Resource"
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Response:**
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"id": "2",
|
|
124
|
+
"name": "New Resource",
|
|
125
|
+
"createdAt": "2024-01-01T00:00:00.000Z"
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**cURL Example:**
|
|
130
|
+
```bash
|
|
131
|
+
curl -X POST http://localhost:3000/api/resources \
|
|
132
|
+
-H "Content-Type: application/json" \
|
|
133
|
+
-d '{"name": "New Resource"}'
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
#### Update Resource
|
|
139
|
+
|
|
140
|
+
**Request:**
|
|
141
|
+
```http
|
|
142
|
+
PUT /api/resources/:id
|
|
143
|
+
Content-Type: application/json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Body:**
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"name": "Updated Resource"
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Response:**
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"id": "1",
|
|
157
|
+
"name": "Updated Resource",
|
|
158
|
+
"updatedAt": "2024-01-01T00:00:00.000Z"
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**cURL Example:**
|
|
163
|
+
```bash
|
|
164
|
+
curl -X PUT http://localhost:3000/api/resources/1 \
|
|
165
|
+
-H "Content-Type: application/json" \
|
|
166
|
+
-d '{"name": "Updated Resource"}'
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
#### Delete Resource
|
|
172
|
+
|
|
173
|
+
**Request:**
|
|
174
|
+
```http
|
|
175
|
+
DELETE /api/resources/:id
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Response:**
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"success": true,
|
|
182
|
+
"message": "Resource deleted"
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**cURL Example:**
|
|
187
|
+
```bash
|
|
188
|
+
curl -X DELETE http://localhost:3000/api/resources/1
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Error Responses
|
|
194
|
+
|
|
195
|
+
All errors follow this format:
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"error": {
|
|
200
|
+
"code": "ERROR_CODE",
|
|
201
|
+
"message": "Human-readable error message"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Error Codes
|
|
207
|
+
|
|
208
|
+
| Code | HTTP Status | Description |
|
|
209
|
+
|------|-------------|-------------|
|
|
210
|
+
| `VALIDATION_ERROR` | 400 | Invalid request data |
|
|
211
|
+
| `AUTHENTICATION_ERROR` | 401 | Not authenticated |
|
|
212
|
+
| `AUTHORIZATION_ERROR` | 403 | Not authorized |
|
|
213
|
+
| `NOT_FOUND` | 404 | Resource not found |
|
|
214
|
+
| `CONFLICT_ERROR` | 409 | Resource conflict |
|
|
215
|
+
| `RATE_LIMIT_ERROR` | 429 | Too many requests |
|
|
216
|
+
| `INTERNAL_ERROR` | 500 | Server error |
|
|
217
|
+
|
|
218
|
+
### Error Examples
|
|
219
|
+
|
|
220
|
+
**Validation Error:**
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"error": {
|
|
224
|
+
"code": "VALIDATION_ERROR",
|
|
225
|
+
"message": "Name is required"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Not Found:**
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"error": {
|
|
234
|
+
"code": "NOT_FOUND",
|
|
235
|
+
"message": "Resource not found"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Rate Limiting
|
|
241
|
+
|
|
242
|
+
> Add rate limiting details here if applicable
|
|
243
|
+
|
|
244
|
+
## Pagination
|
|
245
|
+
|
|
246
|
+
List endpoints support pagination:
|
|
247
|
+
|
|
248
|
+
```http
|
|
249
|
+
GET /api/resources?limit=10&offset=20
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Response includes pagination info:
|
|
253
|
+
```json
|
|
254
|
+
{
|
|
255
|
+
"data": [...],
|
|
256
|
+
"total": 100,
|
|
257
|
+
"limit": 10,
|
|
258
|
+
"offset": 20
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Next Steps
|
|
263
|
+
|
|
264
|
+
- [Troubleshooting](04-TROUBLESHOOTING.md)
|