For what require() is used in Node Js ?

devquora
devquora

Posted On: Apr 08, 2024

 

require() is used to include modules from external files in Node Js. It is the easiest way to include a module in Node. Basically require is a function that takes a string parameter which contains the location of the 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');

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Node JS Interview Questions

    What is Node js ?

    Node Js is one of the most popular and powerful server technologies today. It allows you built the entire website only..

    Node JS Interview Questions

    Explain CLI in Node.js?

    CLI stands for Command Line Interface. It is a utility or program on your computer where users type commands to perform..

    Node JS Interview Questions

    In which Language Node Js is written ?

    Node js is written in C, C++,JavaScript.It uses Google’s open source V8 Javascript Engine to convert Javascript code..