Node.js process.debugPort Property
Last Updated :
12 Oct, 2021
Improve
The process.debugPort property is an inbuilt application programming interface of the process module which is used to get the debugging port used by the debugger if enabled.
Syntax:
javascript
Output:
javascript
Output:
process.debugPortReturn Value: This property returns an integer value that specifies the debugging port used by the debugger if enabled. Below examples illustrate the use of process.debugPort property in Node.js: Example 1:
// Node.js program to demonstrate the
// process.debugPort property
// Include process module
const process = require('process');
// Printing process.debugPort
console.log("debug port is " + process.debugPort);
debug port is 9229Example 2:
// Node.js program to demonstrate the
// process.debugPort property
// Include process module
const process = require('process');
// Printing process.debugPort property value
var debug_port = process.debugPort;
// Check whether debug port is defined
if(debug_port != undefined){
console.log("debug port is defined");
console.log("debug port is " + debug_port);
}else{
console.log("debug port is not defined");
}
debug port is defined debug port is 9229Note: The above program will compile and run by using the
node filename.js
command.
Reference: https://nodejs.org/api/process.html#process_process_debugport