Q:

node js

setTimeout(function () {
    console.log("5 secondes"); 
}, 5000); 
console.log("now");
1
const readline = require("readline");

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.question("What is your name ? ", function saveInput(name) {
  console.log(`His name is ${name}`);
  rl.close();
});

rl.on("close", function saveInput() {
    console.log("\nBYE BYE !!!");
    process.exit(0);
});
5
basic server

const express =require('express');
const app = express();
const PORT = 5000;


app.get('/',(req,res)=>{
   res.json({message: 'Welcome to the backend'})
})


app.listen(PORT ,()=>console.log(`Connected to ${PORT}`)
           
           
10
const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
9
function createElementFromHTML(htmlString) {
  var div = document.createElement('div');
  div.innerHTML = htmlString.trim();

  // Change this to div.childNodes to support multiple top-level nodes
  return div.firstChild; 
}
0
NodeJs is Runtime environment for executing Js code, Outside Of Browser.
it is build upon Chrome v8 engine using c++.

Uses of Node:

-can build back-end services like API which can be used as backend for 
diferent platform Apps(Website, MobileApp, Desktop App).

-is Asynchronous by default means Single thread handle all the request
and response, thereby providing more speed, highly scalable, built time half 
compare to other tech in market, 33% few line of code, 40% fewer files,
can handle 2times more requests/secs, 35% fast response time.
// Hope you like the short Description.
5
Node js allows you to run javascript outside of your browser
ex: you are able to run it on your terminal
15
When you install Node.js, you can do these things:
Make web servers
Run JavaScript without an HTML file
...and more!
4
/*What is Node.js?
Node.js is an open source server environment
Node.js is free
Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
Node.js uses JavaScript on the server*/
1

New to Communities?

Join the community