This is demo repo to demostrate how to work with Winston logging in Node Express JS Rest API. Logging will output to STROUT (console) and log path (/logs/log.log). This repo also contain containerization materials for futher deployment in Kubernetes (K8S) cluster (e.g Azure Kubernetes Service (AKS)).
Readme update 1.0
- Logging format = Type, Label, Datetime, Status Code, Status Message, Request Path, Request Method, Client IP, Host IP
Please refer to index.js line 6 - 27 for core Winston configuration.
Line 33 for normal response capture.
Line 38 - 47 for error capture.
node index.js
http://localhost:8081
- Build a docker image using
Dockerfile
:docker build -t node-express-js-rest-api-demo .
- Run docker image locally
docker run --rm -p 8081:8081 node-express-js-rest-api-demo
- Then you can access the Rest API at http://localhost:8081/listSAs from Postman.
kubectl apply -f node-express-js-rest-api-demo.yaml