Chapter 12: Useful Node.js APIs

This chapter demonstrates a selection of regularly used APIs that are built in to the standard Node.js runtime. You’ve seen some in previous chapters of this book, but I hope the following sections will pique your interest and encourage you to browse the Node.js API documentation.

Module node: URL Imports

Node.js 14 and above support node: imports for both ESM and CommonJS modules. Rather than using the API’s module name:

import path from 'path';

… you can reference it using an absolute node: URL:

import path from 'node:path';

This might be practical if you had another module named path or want to distinguish built-in APIs in your code.

Process

The process object provides information about your Node.js application ...

Get Node.js: Novice to Ninja now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.