Skip to content

Node #2

@newswim

Description

@newswim

Core concepts

How do modules work?

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').sayHi

You'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

Node Debugger

Core modules (assert, crypto, http, event emitters)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions