Node.js – Errors

Node.js provides multiple ways for the propagating and handling errors occur during the Node.js application execution. The error reported by a Node.js application depends on the type of error. There are generally four types of errors in the Node.js application. Standard JavaScript errors – Like EvalError SyntaxError RangeError ReferenceError TypeError URIError System Error – For example attempt to open a file that does not exist, attempting to send data over a closed socket, etc; User-specified Errors – These errors triggered by application code. Also can be known as human mistakes…

Read More

Node.js – Hello World Example

You can run Node.js application an console based or web-based application. Console based application will run your system terminal and a web-based application will use an inbuilt web server to make an application accessible on the web browser. Console-based Hello World Example Use the Node.js console module to print output on your system console. Create a JavaScript file nodejs_hello_console.js using the below content.

Execute your script using the node node nodejs_hello_console.js [output] Hello World! Web-based Hello World Example A Node.js web application is build with 3 parts. Import module…

Read More