- Node.js is an event-driven non-blocking JavaScript middleware. Opponents are Spring, Django, Java Enterprise Edition (Java EE)… or Deno, Bun (written in Zig)… in the JavaScript/TypeScript ecosystem.
- Version:
node -v
- Capability:
node -h
- Execution:
node Main.js
- Node.js comes with a lot of native libraries like
fs
(file system),http
,path
…, but its ecosystem is rich of numerous external libraries whose consistent management relies on npm (Node.js package manager)- Program example (using Puppeteer ext. lib.) ☛
npm is in sync with a
package.json
file for configuration purposes including file location, nature, purpose… library versioning, licensing, etc.Library versioning
- Reminder on versioning: "4.17.1" ⤳ major: 4 (backward incompatible), minor: 17 (backward compatible), and patch: 1
- So
"express": "~4.17.1",
⤳ patches only, e.g., up to"4.17.3"
- So
"express": "^4.17.1",
⤳ up to non-breaking API, i.e., very latest minor version, e.g., up to"4.18.1"
"mongodb": "*",
⤳ upgrades to very last versionOther configurations
"engines": { "node": ">=10" },
⤳ fixes compatible Node.js version"scripts": { "start": "node js/Main.js" },
- Etc.
- Where is Node.js on macOS ⤳
which node
⤳/usr/local/bin/node
- Where is Node.js on Windows ⤳
Get-Command node
⤳C:\Program Files\nodejs\node.exe
- Update of Node.js ⤳ best and simpler solution is downloading the latest version and installing it…
- macOS (update Homebrew) ⤳
brew -v;brew upgrade
- macOS ⤳
brew uninstall --force node
(if installed with Homebrew only)- -OR- macOS (install Node Version Manager) ⤳
brew install nvm
/brew reinstall nvm
- macOS ⤳
nvm uninstall v17.8
- Version check of npm:
npm -v
- Where is npm on macOS:
which npm
⤳/usr/local/bin/npm
- Where is npm on Windows:
Get-Command npm
⤳C:\Program Files\nodejs\npm.cmd
- Update:
<sudo> npm install npm@latest -g
(-g
means “global”)- Where are installed modules?
npm root -g
- What are global installed modules?
npm list -g -depth=0
- Installation of library from a directory having a
package.json
file, example:<sudo> npm install ./lib/tracking.js-master
- Programming Node.js with TypeScript ☛
- Blocking versus non-blocking ☛
- Node.js module system ☛
- Environment variables within Node.js ☛
- Programming Web server with Node.js ☛
- Querying the Web with Node.js ☛
- Database tiers with Node.js ⤳ SQL ☛
- Database tiers with Node.js ⤳ NoSQL ☛
- Micro-services with Node.js ☛
- Messaging with Node.js ☛
- Authentification ☛
- Orchestration ☛
- Web streams ☛
- Clustering and worker TO DO ☛
- WebAssembly ☛
*Tout ou partie des mécanismes énoncés peuvent (probablement) répondre au besoin. Toutefois, il faut choisir (cocher) le mécanisme le plus simple, direct et rationnel qui amène à produire le moins de code possible au regard du besoin évoqué.
- Internet of Things -IoT-: Node-RED