test-git-fcz5/README.md

100 lines
2.2 KiB
Markdown

# test-git-fcz5
Production-ready Node.js API server for testing git serverless deployment.
## Features
- ✅ Express.js REST API
- ✅ CRUD operations (Users & Tasks)
- ✅ Health checks (`/health`, `/ready`)
- ✅ Environment info endpoint (`/api/env`)
- ✅ Production-ready Dockerfile (multi-stage)
- ✅ Security middleware (Helmet, CORS)
- ✅ Request logging (Morgan)
- ✅ Gzip compression
## API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/` | Service info |
| GET | `/health` | Health check |
| GET | `/ready` | Readiness check |
| GET | `/api/env` | Environment variables (for testing) |
| GET | `/api/users` | List all users |
| GET | `/api/users/:id` | Get user by ID |
| POST | `/api/users` | Create user |
| PUT | `/api/users/:id` | Update user |
| DELETE | `/api/users/:id` | Delete user |
| GET | `/api/tasks` | List tasks (filter by userId, status) |
| POST | `/api/tasks` | Create task |
| PATCH | `/api/tasks/:id/status` | Update task status |
| ALL | `/api/echo` | Echo request details |
## Local Development
```bash
# Install dependencies
npm install
# Run in development mode
npm run dev
# Run in production mode
npm start
```
## Docker
```bash
# Build image
docker build -t test-git-fcz5 .
# Run container
docker run -p 8080:8080 test-git-fcz5
```
## Testing API
```bash
# Health check
curl http://localhost:8080/health
# Get environment info
curl http://localhost:8080/api/env
# List users
curl http://localhost:8080/api/users
# Create user
curl -X POST http://localhost:8080/api/users \
-H "Content-Type: application/json" \
-d '{"name": "Test User", "email": "test@example.com"}'
# Create task
curl -X POST http://localhost:8080/api/tasks \
-H "Content-Type: application/json" \
-d '{"userId": "1", "title": "New task"}'
# Update task status
curl -X PATCH http://localhost:8080/api/tasks/1/status \
-H "Content-Type: application/json" \
-d '{"status": "done"}'
```
## Backward Compatibility Testing
This app uses the **OLD boltic.yaml format** (no `serverlessConfig` section).
### Test Steps:
1. Deploy this app BEFORE new conductor code
2. Configure from UI: Scaling, Env, PortMap
3. Deploy new conductor code
4. Push a code change
5. Verify UI settings are preserved
## License
MIT