nodejs ?. code example

Example 1: what is node.js

Javascript was always a client side language until node.js.
Common server side languages include PHP, Python, Perl, Ruby
and several more. Node enables you to use Javascript server side.
This now means you can have a consistent language both ends
which could not be done prior to Node.

Example 2: node js

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.

Example 3: node js

Node js allows you to run javascript outside of your browser
ex: you are able to run it on your terminal

Example 4: nodejs

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

Tags: