Smart House BE
# set DEBUG env variable to get debug logs DEBUG=express-mongoose-es6-rest-api:* npm start # or without debug npm start
# will run api backend npm run api
# run unit and integration tests npm test
# run all tests with coverage npm run test-coverage
# run only unit tests npm run test:unit # watch mode npm run test-watch:unit
# run only integration tests npm run test:integration # watch mode npm run test-watch:integration
# Lint code with ESLint npm run lint
Universal logging library winston is used for logging. It has support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file. We just log to the console for simplicity, you can configure more transports as per your requirement.
Logs detailed info about each api request to console during development.
Logs stacktrace of error to console along with other details. You should ideally store all error messages persistently.
Get code coverage summary on executing
npm test also generates HTML code coverage report in
coverage/ directory. Open
lcov-report/index.html to view it.