-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Core concepts
How do modules work?
- This article explains that pretty well - https://www.sitepoint.com/understanding-module-exports-exports-node-js
basically, exports is an object which you can attach properties/methods to, just like any other object.. but the require function will parse a file and bind a matching keyword to a variable.
// lib.js
function sayHi () { return 'Hi' }
exports.sayHi = sayHi
// or..
exports.sayHi = function () { return 'Hi' }
// main.js
const sayHi = require('./lib').sayHiYou're simply accessing that property on the global object, module.exports (or exports, which its aliased to.)
NPM / Using Community Modules and Publishing To NPM
CLI
Processes
Asynchronous functions
- Promises
- Callbacks
- Async/Await
- Generators
- Fibers/Coroutines