Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What is the purpose of module.exports in Node.js?
Home
NodeJS Essentials
What is the purpose of module.exports in Node.js?
+1
vote
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
What is the purpose of
module.exports
in Node.js?
#node
js-purpose
#module
exports-node
js
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
May 31, 2020
by
SakshiSharma
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
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
+1
vote
Q: What is Streams in Node.js?
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#node
js-streams
#streams-node
js
+1
vote
Q: What is EventEmitter in Node.js?
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#node
js-eventemitter
#eventemitter-node
js
+1
vote
Q: What are some of the most popular modules of Node.js?
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#node
js-popular-modules
js-modules
#modules-node
js
+1
vote
Q: What is libuv in Node.JS
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#node
js-libuv
#libuv-node
js
+1
vote
Q: How will you debug an application in Node.js?
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#node
js-debug
#debug-node
js
+1
vote
Q: What is Tracing in Node.js?
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#node
js-tracing
#tracing-node
js
0
votes
Q: What is REPL in Node.js?
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#node
js-repl
#repl
#repl-node
js
0
votes
Q: What is Event loop in Node.js work? And How does it work?
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#node
js-loop
js-work
#use-node
js
js-advantages
+1
vote
Q: What is Node.js? What is it used for?
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#what-is-node
js
#node
js-use
+1
vote
Q: What is Node.Js or Node,JS Tutorial?
asked
May 30, 2020
in
NodeJS Essentials
by
SakshiSharma
#node
js
#what-is-node
...