Skip to main content

Posts

Showing posts with the label nodeJS

Winston- A logger for just about everything

       Winston   Winston is a popular logging library for Node.js applications. It is intended to be simple and adaptable, with support for a variety of transports, formats, and logging levels. As a result, it is a versatile tool for logging application events, failures, and other data.   Here are some of the key features of Winston: ·          >  Multiple transports: Winston can send logs to multiple destinations, such as the console, a file, or a remote server. This allows you to centralize your logs and make them easier to analyze.         >  Flexible formatting: Winston supports a variety of log formats, including JSON, plain text, and custom formats. This allows you to tailor your logs to your specific needs. ·          >  Logging levels: Winston supports multiple logging levels, such as error, warn, info, and debug. This allows you to control the verbosity of your logs. In addition to these core features, Winston also supports several advanced fea

package.json in any node JS project

What is package.json in any node JS project? package.json is the heart of any Node.js project. Every Node JS project should have this file at the root directory. This file lists: • All the packages/modules needed for a Node JS project and their requested versions. • Several different directives or elements that tell NPM “How to handle the project” like scripts that can be run to automate tasks within the project. • All the metadata for a project, such as a name, the author, the license, etc. It makes your build reproducible, and therefore easier to share with other developers. In Simple words , if you have worked on any Java/Maven project- what pom.xml is for maven project; is the same as what package.json is for any Node JS Project. How we can generate it (package.json)? 1. Using “npm init” : Running this command (‘npm init’) will set up a new NPM package. On initializing, you will be prompted to enter a few answers. Once you answer those and if it worked successf