·
🐾 NutriPaw — Mock API
Running
localhost:3001
Rutas activas
9
4 GET · 3 POST · 1 PUT · 1 DELETE
Respuestas definidas
21
200/201/400/401/404
Reglas condicionales
6
query · header · params
Faker helpers
14
person · animal · date · uuid
Todas las rutas mock-environment.json
Método
Endpoint
Respuestas
Faker
Reglas
Delay
POST
/auth/login
200401
🎲 person
header
0 ms
GET
/pets
200401
🎲 animal
header
120 ms
GET
/pets/:id
200404401
🎲 animal
params
80 ms
POST
/pets
201400
🎲 uuid
0 ms
GET
/pets/:id/plans
200404
🎲 date
200 ms
GET
/orders
200401200
🎲 finance
query
150 ms
POST
/orders
201400
🎲 uuid
0 ms
Configuración de entorno
📄 mock-environment.json json
// NutriPaw — Mock API v1.0 { "uuid": "nutripaw-mock-api", "name": "NutriPaw API", "port": 3001, "hostname": "0.0.0.0", "routes": [ { "method": "get", "endpoint": "pets", "responses": [ { "statusCode": 200, "body": "{ \"pets\": [{{#repeat 3}}{ \"id\": \"{{faker 'string.uuid'}}\", \"name\": \"{{faker 'animal.dog'}}\", \"species\": \"dog\", \"owner\": \"{{faker 'person.fullName'}}\" }{{/repeat}}] }", "default": true } ] } ] }
🎲 mock-templating.json handlebars
// Faker helpers usados en NutriPaw { "petId": "{{faker 'string.uuid'}}", "petName": "{{faker 'animal.dog'}}", "ownerName": "{{faker 'person.fullName'}}", "ownerEmail": "{{faker 'internet.email'}}", "planStart": "{{now 'yyyy-MM-dd'}}", "planKcal": "{{faker 'number.int' min=800 max=2400}}", "planProtein": "{{faker 'number.float' min=18 max=35 fractionDigits=1}}", "orderId": "{{faker 'string.uuid'}}", "orderTotal": "{{faker 'finance.amount' min=9 max=89 dec=2}}", "token": "Bearer {{faker 'string.alphanumeric' length=64}}", // Referencia request actual "requestId": "{{urlParam 'id'}}", "search": "{{queryParam 'status'}}", "authHeader": "{{header 'Authorization'}}" }
Reglas de respuesta condicionales
🔐 Autenticación · /auth/login
IF
Header Authorization está vacío
401 Unauthorized
{"error": "No token"}
ELSE
200 OK con JWT simulado de 64 chars
🐾 Mascota no encontrada · /pets/:id
IF
Param :id equals 999
404 Not Found
{"error": "Pet not found"}
ELSE
200 OK con datos faker realistas
📦 Pedidos cancelados · /orders
IF
Query status=cancelled
200 OK con array de pedidos cancelados
ELSE
200 OK con pedidos activos (3 items faker)
Pipeline CI/CD · GitHub Actions
⚙️ .github/workflows/mock-api.yml — Integration Tests (ubuntu-latest · Node 20)
checkout
@v4
setup-node
v20
npm ci
dependencies
start mock
:3001
🧪
npm test
e2e Playwright
📊
upload
test report
Docker — QA compartido
# run-mockoon-docker.sh
docker run -d --name mockoon-nutripaw \
  -p 3001:3001 \
  -v $(pwd)/mock-environment.json:/data/mock.json \
  mockoon/cli:latest \
  --data /data/mock.json --port 3001