Topic 2
Basics of Nodejs and Installation
Nodejs Installation
- Download Link: (Install The LTS One)
- Youtube Tutorial
What is Nodejs?
- Node.js is a JavaScript runtime built on Chromeβs V8 JavaScript engine.
- Node.js is free and open source.
- Node.js is platform independent.
- Node.js uses JavaScript on the server.
What Can Node.js Do?
- Node.js can generate dynamic page content
- Node.js can create, open, read, write, delete, and close files on the server
- Node.js can collect form data
- Node.js can add, delete, modify data in your database
Node allows developers to write JavaScript code that runs directly in a computer process itself instead of running it in a browser. Node can, therefore, be used to write server-side applications with access to the operating system, file system, and everything else required to build fully-functional applications.
Good Reads
Why Node?
Node βuses an event-driven, non-blocking I/O model.β
- In practice, this means that Node is built well to handle asynchronous JavaScript code to perform many asynchronous activities such as reading and writing to the file system, handling connections to database servers, or handling requests as a web server.
- To handle asynchronous code, Node uses a callback-based system.
Things to try
Try this after installation
After installing node try to do this-
Save the following in script.js file
console.log("I am a Node program");
Running the terminal command node script.js in the same folder as script.js will start Node, print I am a Node program to the terminal window, and exit, as the script file has finished execution.