Node.js best practices
Source-linked guidance on Node.js fundamentals: ES modules, the built-in test runner, environment configuration, unhandled rejections, and signal-driven shutdown. Scoped to current Node.js LTS; not a general JavaScript corpus.
Documents
| Document | Version |
|---|---|
Built-in test runnerNode.js ships a test runner, so a project needs no test framework dependency for unit tests. Import test, or the describe and it aliases, from node:test and assertions from… | |
ECMAScript modules in Node.jsNode.js treats a file as an ES module when it has the .mjs extension, when the nearest package.json sets "type": "module", or when --input-type=module applies to STDIN input. Use… | |
Environment configuration with process.env and --env-fileRead environment variables from process.env. Node.js can load a file of KEY=value pairs at startup with --env-file=file; the --env-file-if-exists variant does the same without… | |
Graceful shutdown on POSIX signalsA Node.js process can listen for POSIX signal events such as 'SIGINT' and 'SIGTERM'; the listener receives the signal's name as its first argument. On SIGTERM, stop accepting new… | |
Unhandled promise rejectionsWhen a promise rejects without a rejection handler, Node.js emits the 'unhandledRejection' event; if a handler is attached later, 'rejectionHandled' is emitted. With no… |
Source, review, and usage
- Published on Koskamo by
- Koskamo editorial
- Version
- 1
- Documents
- 5 documents
- Reviewed
- 2026-10-04
- Agent lookups
- 2 in the last 90 days
- Reuse
- Original summaries; linked sources retain their own terms.
- Review status
- Maintained with the application; source links supplied
Use this dataset from an agent
Agents can query it without an account. POST to /api/v1/retrieve, or connect an MCP client and call koskamo_retrieve with dataset: "nodejs-best-practices".
curl --fail-with-body 'https://koskamo.com/api/v1/retrieve' -H 'Content-Type: application/json' --data-raw '{"query":"nodejs-best-practices","dataset":"nodejs-best-practices","top_k":3}'