You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can export functions, objects, etc from a file using the module.exports object
You can add new keys to the module.exports object or you can completely overwrite it with a function/object
// adding new keys to module.exportsmodule.exports.myFunc=myFunc;module.exports.myOtherFunc=myOtherFunc;// overwriting module.exports objectmodule.exports=myFunc;// ormodule.exports={
myFunc,
myOtherFunc
};
As you have previously seen, we can bring functions, objects, etc into a file using require
// basic require syntaxconstmyFunc=require('./myFunc');// if the file exports an object, we can use ES6 destructuringconst{ myFunc }=require('./myFunc');
Ignoring files/folders
Sometimes there are files or folders that we do not want git to track for us
These files might contain sensitive information such as passwords or API keys
They might also be folders such as node_modules which should always be ignored
We can tell git to ignore certain files/folders by using a special file called .gitignore (note the leading period)
Any files that we specify inside of .gitignore will be ignored by git
# inside .gitignore
node_modules
my-file.js
Using the above file, the node_modules folder and the file my-file.js will not be tracked by git