Share:- Whatsapp Facebook Facebook

------------------------------------- Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.

What require() is used in Node.js

0 votes
25 views
What require() is used in Node.js ?
asked Nov 9, 2018 in Node.js by vikas singh

1 Answer

0 votes
require():- The require() method is used to include modules from external files in Node.js. It is the easiest way to include a module in Node.js. The require function takes a string parameter which contains the location of file that you want to include. It reads the entire javascript file, executes the file, and then proceeds to return the exports object.

Syntax:-
require('path');
answered Nov 10, 2018 by ranju_12 (3,740 points)
...