21 BasicsofNodeJS
21 BasicsofNodeJS
js:
Node is an open-source, Cross Platform, Java script runtime environment and used for executing Java
Script code outside web browser.
Node.js is a great web framework for beginners because it works great for data-intensive applications,
like streaming and real-time apps, and Node.js makes it easy to start building backend.
Capabilities of Node.js , it is used to build below Applications
- Build Application Logic
- Web Server
- Send Email
- DB lookups
- Automations
- Outputs
- Host Web Apps
Development tools:
BAS
VSCODE- Free tool provided by Microsoft. Its gives thousands of plug ins, makes of life of
developer is easy.
Download and install node js - https://nodejs.org/en/
Test if its available
node -v
To test
node sample.js
Its case sensitive
Select the block of code, and use ctrl + / to comment the code
parseInt
console.log("Hello node.js by Sandeep");
var x = 10;// this will create variable x of type number
console.log(x);
console.log(typeof(x));
var y = "10";
console.log('y is of type :' + typeof(y));
y = parseInt(y);
console.log('y is of type :' + typeof(y));
z = false;
console.log('z is of type :' + typeof(z));
// Working with objects, they are like structures in ABAP, contains multiple
fileds of different type
var oEmployee = {
"empId" : 123456,
"empName" : "Sandeep",
"salary": 5000,
"currency": "USD"
};
console.log("A new object ------>" , oEmployee);
var complexJson = {
empTab : [],
cities : [],
gender : {}
};