Also, the second question. I'm beginner at express. Do you know of any good websites where I can learn? The documentations are most of the time vague and therefore not so easy for a beginner. Thanks
Asked
Active
Viewed 42 times
-2
-
Try to learn from Tutorials of CodewithMosh https://codewithmosh.com. It has Node.js course, where you call learn both nodejs and express. – Jun 22 '19 at 12:53
-
https://nodejs.org/api/modules.html – Bergi Jun 22 '19 at 14:13
1 Answers
1
A module encapsulates related code into a single unit of code. When creating a module, this can be interpreted as moving all related functions into a single file. When you want to use this encapsulated functions in another file, you should import them into your current working file. exports object decides what functions can be imported and what are private for the file only. Below sayHelloInEnglish
can be imported, but sayGoodbye
can not.
exports.sayHelloInEnglish = function() {
return "HELLO";
};
sayGoodbye = function(){
return "Goodbye";
}

Felipe Augusto
- 7,733
- 10
- 39
- 73

Muslimchik Kholjuraev
- 61
- 10