In this session, you learned about:
npm init
npm install nameOfPackage
This will install the package in your application.
nodemon is a package that automatically runs your code when any file is changed & saved.
There are three different types of modules/packages in Node:
Custom Modules/Packages: These packages are created & defined by the user.
Third-party Modules/Packages: These are provided by Node Package Manager.
Core Modules: These modules are provided by Node by default.
Using the chalk package you can print the text in different colours and also define your own themes.
File system operations in Node may have Synchronous as well as asynchronous form.
fs core module is used for file management in Node. You looked at two of its APIs-writeFile and writeFileSync. writeFile is an asynchronous API whereas writeFileSync is a synchronous API.
You also learned how to create and listen to events in Node. You first import the events module, then created an object of the EventEmitter class. After that, you bind an event with its eventHandler using the on property and then fire an event using the emit property.
JSON stands for JavaScript Object Notation. It is a light-weight data interchange format.
You learned how JSON is different from JavaScript Object Literal. You also learned about two important methods of JSON namely - JSON.stringify() and JSON.parse().