What is Node js ?
Node.js is an open-source, cross-platform JavaScript runtime environment that allows developers to run JavaScript code outside of a web browser. It is built on the V8 JavaScript engine, which is the same engine used by Google Chrome. Node.js enables developers to use JavaScript for server-side scripting, enabling them to build scalable, high-performance web applications and backend services.
Advantage of Node.js
- Open source
- Efficient Fast and highly scalable
- Event Driven
- Very popular
1st step create below file
index.js
and put below code
const http = require("http");
const myServer = http.createServer((req,res)=>{
console.log("New request is coming");
res.end('Hellow from server');
});
myServer.listen(8000,()=>console.log('server started'));
Next go to package.json and put below code
Next to run below command for start the app
npm start
Output:-
Thanks for reading šš