# set DEBUG env variable to get debug logsDEBUG=express-mongoose-es6-rest-api:* npm start# or without debugnpm start
Start server in production mode:
# will run api backendnpm run api
# run unit and integration testsnpm test
# run all tests with coveragenpm run test-coverage
# run only unit testsnpm run test:unit# watch modenpm run test-watch:unit
# run only integration testsnpm run test:integration# watch modenpm run test-watch:integration
# Lint code with ESLintnpm 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.