π This repository contains practical examples for each of the points in the official NodeJS documentation for the preparation of NodeJS certification - Application Developer (JSNAD).
The OpenJS Foundation is committed to growing our community of hosted projects. We believe it is important to foster a broad range of skills within the contributor and implementer communities, enabling continued and sustained adoption of JavaScript and related technologies.
The OpenJS Node.js Application Developer certification is ideal for the Node.js developer with at least two years of experience working with Node.js.
This repository contains practical examples for each of the points in the official NodeJS documentation for the preparation of NodeJS certification.
Usage & Example
Assertion Testing
Buffer
Child Processes
Cluster
Console
ECMAScript Modules
Errors
Events
File System
HTTP
HTTP/2
HTTPS
Inspector
Internationalization
Modules
Net
OS
Path
Performance Hooks
Process
Query Strings
Readline
REPL
Report
Stream
String Decoder
Timers
TLS/SSL
Trace Events
TTY
UDP/Datagram
URL
Utilities
V8
VM
Worker Threads
Zlib
- Buffer and Streams β 11%
- Node.js Buffer APIβs
- Incremental Processing
- Transforming Data
- Connecting Streams
- Control flow β 12%
- Managing asynchronous operations
- Control flow abstractions
- Child Processes β 8%
- Spawning or Executing child processes
- Child process configuration
- Diagnostics β 6%
- Debugging Node.js
- Basic performance analysis
- Error Handling β 8%
- Common patterns
- Handling errors in various scenarios
- Node.js CLI β 4%
- Node executable command line flags
- Events β 11%
- The event system
- Building event emitters
- Consuming event emitters
- File System β 8%
- Input/output
- Watching
- JavaScript Prerequisites β 7%
- Language fundamentals
- Scoped to core language features introduced since EcmaScript 1 and still heavily used today
- Module system β 7%
- CommonJS Module System only
- Process/Operating System β 6%
- Controlling the process
- Getting system data
- Package.json β 6%
- Package configuration
- Dependency management
- Unit Testing β 6%
- Using assertions
- Testing synchronous code
- Testing asynchronous code
-
Generic
-
Child Processes
-
Console
-
ECMAScript Modules
-
Events
-
File System
-
Stream
-
Worker Threads
-
Control Flow
-
Performance Hooks
ESTlint, tool for identifying and reporting on patterns found in ECMAScript/JavaScript code.
NPM ESLint
NPM ESLint | Airbnb
$npm i# If your NodeJS version is previous than v13.2.0
$node --experimental-modules ./src/'folder'/'file.mjs'
# If your NodeJS version is v13.2.0 or higher
$node ./src/'folder'/'file.mjs'# If you want use http2 you need generate localhost certificate
$openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' \ -keyout localhost-privkey.pem -out localhost-cert.pem/
βββ assets π # Images Sources.
| βββ ... # ...
| |
βββ env π # Configure enviroments deploy.
| βββ ... # ...
| |
βββ src π―
| βββ usage-example # Usage & Example.
| | βββ example01 # Http server return pain text.
| | βββ example02 # Http server return json object.
| |
| βββ assertion-testing # Assertion Testing.
| | βββ example01 # Equal numbers or not with assert.strictEqual method.
| | βββ example02 # Equal numbers and string or not with assert.equal method.
| | βββ example03 # Equal arrays values and structure or not with strict.deepEqual method.
| | βββ example04 # Equal objects values and structure or not with strict.deepEqual method.
| | βββ example05 # Http request with Reject results and objects results with structure and typeof control.
| |
| βββ async-hooks # Async Hooks.
| | βββ example01 # Create http server with external request to get content. This functions launch async hooks and save into .log file.
| | βββ test.log # Log example file.
| | βββ ... # ...
| |
| βββ buffer # Buffer.
| | βββ example01 # Create first safe and not Buffer empty and with string.
| | βββ example02 # Get length of string and buffer string.
| | βββ example03 # Is Buffer and is Encoding functions.
| | βββ example04 # Work with compare, concat, equal, includes, indexOf, lastIndeOf, keys and slice functions.
| | βββ example05 # Work with toString and toJSON functions.
| | βββ ... # ...
| |
| βββ child-processes # Child Processes.
| | βββ example01 # spawn function.
| | βββ example02 # exec and execSync functions.
| | βββ example03 # spawn and spawnSync functions.
| | βββ example04 # exec and spawn functions with custom sh file.
| | βββ example05 # exec and spawn functions with magick tool (you need install imagemagick library).
| | βββ example06 # execFile and execFileSync functions.
| | βββ example07 # fork function with example messages to childs.
| | βββ example07-sub01 # sub process message fork function.
| | βββ example07-sub01 # sub process message fork function.
| | βββ example08 # fork function with process ls and sh.
| | βββ example08-sub01 # sub process spawnSync ls fork function.
| | βββ example08-sub01 # sub process spawnSync sh fork function.
| | βββ test.sh # Sh example file.
| | βββ cat.jpg # Image cat example.
| | βββ ... # ...
| |
| βββ cluster # Cluster.
| | βββ example01 # Show CPUs number and create a cluster for each core.
| | βββ example02 # Control cluster waiting or working any task.
| | βββ ... # ...
| |
| βββ console # Console.
| | βββ example01 # Basic console log, error and warn.
| | βββ example02 # Console log with params added.
| | βββ example03 # Show and get log and save into .log files (out and error files).
| | βββ example04 # Clear console with setTimeout into async function.
| | βββ example05 # Assert, count, countReset.
| | βββ example06 # Group and groupEnd.
| | βββ example07 # Time and timeEnd.
| | βββ example08 # Table with arrays of numbers, objects and more arrays of strings.
| | βββ ... # ...
| |
| βββ esm # ECMAScript Modules.
| | βββ example01 # Import esm module with .js extension file.
| | βββ example02 # Import esm module from "libs" folder into your js application with .js extension file.
| | βββ example03 # Import esm submodule from "libs" folder into your js application with .js extension file.
| | βββ ... # ...
| |
| βββ errors # Errors.
| | βββ example01 # Variable no defined into try/catch.
| | βββ example02 # With properties of an object in try/catch.
| | βββ example03 # In callback functions.
| | βββ example04 # In try/catch with async and sync functions.
| | βββ example05 # Custom message Error into throw.
| | βββ ... # ...
| |
| βββ events # Events.
| | βββ example01 # Differents instances and times.
| | βββ example02 # Define arguments and show.
| | βββ example03 # Extends class EventEmitter and create main scope with custom properties.
| | βββ example04 # What happens to the functions: setTimeout, setImmediate and process.nextTick.
| | βββ example05 # Handling events only once.
| | βββ example06 # Remove event with removeListener.
| | βββ example07 # Set Max Listeners to event with setMaxListeners.
| | βββ ... # ...
| |
| βββ file-system # File System.
| | βββ example01 # Open and close file by name with concrete path.
| | βββ example02 # Open and close with Url and Buffer.
| | βββ example03 # Get File Descriptors with stat function from json and txt files.
| | βββ example04 # Open folder and file details with opendirSync and openSync functions.
| | βββ example05 # Read folder and file content with readdirSync and readFileSync functions.
| | βββ example06 # Get folder content with Callback, Sync and Promises.
| | βββ example07 # Get file list of folder and content files with Sync.
| | βββ example08 # Get if directory is or not directory and file is or not file.
| | βββ example09 # Access function for get if file exist or not.
| | βββ example10 # Append function for include new data inside file.
| | βββ example11 # Chmod function for set and change permissions of a file.
| | βββ example12 # Chown function for set and change owner and group of a file.
| | βββ example13 # Copy function for copy file from origin to destination.
| | βββ example14 # Create Read Stream from file for get all content and others.
| | βββ example15 # Create file and Write Stream of new file for save all content.
| | βββ example16 # Create symbolic link with link function.
| | βββ example17 # Create directories with mkdir, mkdirSync.
| | βββ example18 # Create temp directories with mkdtemp and mkdtempSync.
| | βββ example19 # Rename file with rename and renameSync functions.
| | βββ example20 # Remove folders with rmdir and rmdirSync functions with recursive option.
| | βββ example21 # Remove files with unlink and unlinkSync functions.
| | βββ example22 # Create listener for get if change the folder and files content.
| | βββ ... # ...
| |
| βββ http # HTTP.
| | βββ example01 # Get methods and status codes from http.
| | βββ example02 # Create http server and show lifecycle-events.
| | βββ example03 # Create http server with custom routers and reponses for POST or GET methods.
| | βββ example04 # Request to url with method GET and port 80 and received JSON object.
| | βββ example05 # Request to url with method POST and port 80 send and received JSON object.
| | βββ ... # ...
| |
| βββ http2 # HTTP2.
| | βββ example01 # Create http2 server and response html elements.
| | βββ example02 # Create http2 server and show lifecycle-events.
| | βββ example03 # Create http and http2 server and see all differences.
| | | βββ example03-http # Create http server and return static file. See that the connection open and close for each request.
| | | βββ example03-https # Create http2 server and return static file. See that the connection open one time and not close for each request.
| | βββ example04 # Create http2 server and with html file and push css and js file.
| | βββ ... # ...
| |
| βββ https # HTTPS.
| | βββ example01 # Create https server and response html elements.
| | βββ example02 # Request to url with method GET and port 443 and received JSON object.
| | βββ ... # ...
| |
| βββ inspector # Inspector.
| | βββ example01 # Create inspector instance and config host and port.
| | βββ example02 # Send console log, warn, info and error.
| | βββ example03 # Send console table.
| | βββ example04 # Create new session for any inspector and report via console.
| | βββ example05 # Create new session for any inspector and write profile.cpuprofile file.
| | βββ ... # ...
| |
| βββ intl # Internationalization.
| | βββ example01 # toLowerCase and toUpperCase functions with String.
| | βββ example02 # Collator functions for get order string and sort string by order.
| | βββ example03 # DateTimeFormat for get date with differents languaje and formats.
| | βββ example04 # NumberFormat for format numbers with differents languaje and formats.
| | βββ ... # ...
| |
| βββ modules # Modules.
| | βββ example01 # Module Exports and Require consts with strings values.
| | βββ example02 # Module Exports and Require function for sum two digits.
| | βββ example03 # Module Exports and Require class with methods.
| | βββ example04 # Module Exports and Require classes extends with methods.
| | βββ example05 # Module Exports and Require classes extends with static method.
| | βββ example06 # Export Default and Import class extends with static method.
| | βββ example07 # Export and Import classes extends with static method.
| | βββ example08 # Two Require of the same Module assign with Require Cache just once.
| | βββ example09 # Require JS Module and JSON File.
| | βββ example10 # Require JS Module from folder with Package.json file.
| | βββ ... # ...
| |
| βββ net # Net.
| | βββ example01 # Server and Client with emit messages and Close Socket Connection.
| | βββ example02 # Server and Client with severals messages from client Without Close Socket.
| | βββ example03 # Server and Two Clients send severals messages to all clientes Without Close Socket.
| | βββ example04 # Server and two clients and send Message to differents client Pear to Pear.
| | βββ ... # ...
| |
| βββ os # OS.
| | βββ example01 # Get and show CPUs numbers and props.
| | βββ example02 # Get and show Free and Total System Memmory.
| | βββ example03 # Get and show Home Directory.
| | βββ example04 # Get and show Host Name Machine.
| | βββ example05 # Get and show Network Interfaces and props.
| | βββ example06 # Get and show Platform and Release.
| | βββ example07 # Get and show Temporal Directory.
| | βββ example08 # Get and show User Info.
| | βββ example09 # Get and show Operating System Constants.
| | βββ ... # ...
| |
| βββ path # Path.
| | βββ example01 # Get Basename of current or specific folder.
| | βββ example02 # Use basename for get all internal files from folder and get basename of files.
| | βββ example03 # Use dirname for get the main folder and all internal files.
| | βββ example04 # Use extname for get extension of file name or all path.
| | βββ example05 # Get if any path is absolute.
| | βββ example06 # Use joins method for concat all string for create a correct path.
| | βββ example07 # Use normalize method for create corrects paths.
| | βββ example08 # Use parse method for get object with all properties of paths.
| | βββ example09 # Use relative method for compare two path and get an absolute path.
| | βββ example10 # Use sep method for generate array with split and resolve a structure with folders and files.
| | βββ ... # ...
| |
| βββ perf-hooks # Performance Hooks.
| | βββ example01 # Timer and measure for JSON parse and stringify functions examples.
| | βββ example02 # Timer and measure for Get all files from specific folders in a function with callback.
| | βββ example03 # Timer and timerify wrapper for Get all files from specific folder with function with callback.
| | βββ example04 # Timers with severals externals request https for others REST APIs.
| | βββ example05 # Show Measure and Mark timers with two Observers
| | βββ example06 # Get duration timer of severals require functions of modules.
| | βββ ... # ...
| |
| βββ process # Process.
| | βββ example01 # Use beforeExit event for get when event loop has no additional work to schedule.
| | βββ example02 # Send message between procces, one http server and other write into file.
| | βββ example03 # Use multipleResolves event for tracking potential errors in an application while using the Promise constructor.
| | βββ example04 # Use multipleResolves event with Promise.race() method returns a promise that fulfills or rejects as soon as one of the promises.
| | βββ example05 # Use unhandledRejection event for get all promise without catch.
| | βββ example06 # Use uncaughtException event for get all error of function without try/catch control.
| | βββ example07 # Use warning event for example to get exceeded listener of Event Emitter.
| | βββ example08 # The argv property contain all arguments include via CLI.
| | βββ example09 # The process.cwd() method returns the current working directory of the Node.js process.
| | βββ example10 # The process.emitWarning() method can be used to emit custom or application specific process warnings.
| | βββ example11 # The process.execArgv property returns the set of Node.js-specific command-line options passed when the Node.js process was launched.
| | βββ example12 # The process.exit() method instructs Node.js to terminate the process synchronously with an exit status of code.
| | βββ example13 # Use getegid, geteuid, getgid, getgroups and getuid functions for show info process identity.
| | βββ example14 # The bigint version of the process.hrtime() method returning the current high-resolution real time in nanoseconds.
| | βββ example15 # The process.memoryUsage() method returns an object describing the memory usage of the Node.js process measured in bytes.
| | βββ example16 # process.nextTick() adds callback to the "next tick queue".
| | βββ example17 # pid, platform, ppid, release props for get additional data of process and NodeJS release.
| | βββ example18 # Returns object the resource usage for the current process.
| | βββ ... # ...
| |
| βββ querystring # Query String.
| | βββ example01 # Use querystring.encode for encode json object to url params.
| | βββ example02 # Use querystring.decode for decode url with several params to json object.
| | βββ ... # ...
| |
| βββ readline # Readline.
| | βββ example01 # Use createInterface and create question and show user answer.
| | βββ example02 # To exit this process you just have to press <ctrl> + C.
| | βββ example03 # Get content for show from txt file for create interface.
| | βββ example04 # Use "process.stdin" events to get more interactions.
| | βββ example05 # Use line, close, pause and resume of readline for get events.
| | βββ example06 # Use keypress, keyup and keydown for get "process.stdin" events.
| | βββ ... # ...
| |
| βββ repl # REPL.
| | βββ example01 # Create REPL and press .help for show all help commands.
| | βββ example02 # Create and press 2 times ^C again or ^D or type .exit.
| | βββ example03 # Run REPL, create a function and execute it..
| | βββ example04 # Create "replServer" and use defineCommand for include Specific Commands.
| | βββ ... # ...
| |
| βββ report # Diagnostic Report.
| | βββ example01 # Write error and report to generic json file with an example.
| | βββ example02 # Write error and report to concrete file with an example.
| | βββ example03 # Launch an error and getReport to show javascriptStack object..
| | βββ example04 # Show errors and reports via EventEmitter.
| | βββ ... # ...
| |
| βββ ...
βββ ...
For review and update all npm dependences of this project you need install in global npm package "npm-check-updates" npm module.
# Install and Run
$npm i -g npm-check-updates
$ncuCreated with JavaScript, lot of β€οΈ and a few βοΈ
