Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

https://127.0.0.1:8081/

var http = require("http");
http.createServer(function (request, response) {
   // Send the HTTP header 
   // HTTP Status: 200 : OK
   // Content Type: text/plain
   response.writeHead(200, {'Content-Type': 'text/plain'});
   
   // Send the response body as "Hello World"
   response.end('Hello World\n');
}).listen(8081);

// Console will print the message
console.log('Server running at https://127.0.0.1:8081/');

fgdfgfdgdfgdgfdgdfdgfgdfdfdfgdf

/* Hello, World! program in node.js */
console.log("Hello, World!")

Execute Node.js Online

function rep() {
    var str = 'Hello World';
    str = setCharAt(str,4,'a');
    console.log("replaced string is",str);
}

function setCharAt(str,index,chr) {
    if(index > str.length-1) return str;
    return str.substr(0,index) + chr + str.substr(index+1);
}
rep();

Encode

/* Simple Hello World in Node.js */
var $main_url = 'https://karmagroup.com/karma-odyssey/member/login/?mid=0000000ivo&key=15b9f384780b930d18e77ef81020e2b3&redirect_to=';
var $app_query = 'render=dialog&viewer=App';
var $url = 'https://karmagroup.com/karma-odyssey/member/search-book/preferred-rates/?resort=Karma%20Minoan&check_in=0&check_out=31-05-2019&query=1';
var $url_decode = decodeURIComponent($url);
var $redirect = $url_decode + ( $url_decode.indexOf( '?' ) == -1  ? '?' : '&' ) + $app_query;
var $redirect_encode = encodeURIComponent($redirect).replace(/%20/g, "+"); // Fix spaces to '+'s
$main_url += $redirect_encode;
console.log($main_url);

as;dfjk

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\n');
});

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

replace string template

/* Simple Hello World in Node.js */
let a = {link:'www.subdomain.com', requestId:'12345', userNameFormat:'US-ENGLISH'};

let mailBody = 'This is an automatic notification to let you know that the records  on #requestId# you had requested are now available for you to view #userNameFormat#. Please log in to the application by clicking the following link: #link#';

Object.keys(a).forEach(key => {
   mailBody = mailBody.replace(`#${key}#`,a[key]);
});
console.log(mailBody);

Woop

var fs = require("fs");

console.log("Going to write into existing file");
fs.writeFile('input.txt', 'Simply Easy Learning!', function(err) {
   if (err) {
      return console.error(err);
   }
   
   console.log("Data written successfully!");
   console.log("Let's read newly written data");
   fs.readFile('input.txt', function (err, data) {
      if (err) {
         return console.error(err);
      }
      console.log("Asynchronous read: " + data.toString());
   });
});

Execute Node.js Online

/* Simple Hello World in Node.js */
console.log("Hello World");

yawar

/* Simple Hello World in Node.js */
console.log("Hello World");

Execute Node.js Online

/* Simple Hello World in Node.js */
console.log("Hello World");

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.