in Node.js Essentials by

What is the purpose of module.exports in Node.js?

1 Answer

0 votes
A module encapsulates related code into a single unit of code. This can be interpreted as moving all related functions into a file. Imagine that we created a file called greetings.js and it contains the following two

Related questions

+1 vote
asked May 31, 2020 in Node.js Essentials by Robindeniel
+1 vote
asked May 30, 2020 in Node.js Essentials by SakshiSharma
0 votes
asked Aug 15, 2021 in APIGEE - API Services by sharadyadav1986