-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodules_in_node.js
43 lines (29 loc) · 1.33 KB
/
modules_in_node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Q) How to install node ?
Q) What is NPM ? what is role of node_modules?
node package manager , manages the dependencies
node modules are dependencies that can be used in node project.Never touch the this folder
Q) What is role of package.json?
contains the project metadata
Q) What is package-lock.json?
The package-lock. json is a lockfile that holds information on the dependencies or packages installed for a node. js project, including their exact version numbers
Q)what are modules in node? what is the differences between a function and module?
a module contains the specific functionality that can be easily resued within a nodejs application
Q)How many ways are thre to export a module?
Q) How to import single and multiple functions for a module?
function sayHello(name){
console.log("Hello, " + name + "!")
}
module.exports = sayHello
Q) What is module wrapper function?
// app.js
const message = "Interview Happy"
console.log(message)
//wrapper function generated by node
(function(exports,require,module,__filename,__dirname){
const message = "Interview Happy"
console.log(message);
})
Q) What are types of modules?
1) built in modules(fs,os,http) , we have to just import and use them
2) local modules(user defined modules)
3) third partt modules (third party ) like npm i lodash