Friday, May 7, 2021

Node.js Slip1

 

Q.1. Create a Node.js fil that will covert the output "Hello  World!" into upper-case letters.

// create Node.js program on notepad /vs code 

First method: to run proram on localhost/web side

var http=require('http');

var uc=require('upper-case');

http.createServer(function(req,res){

res.writeHead(200,{'Content-Type':'text/plain'});

res.write(uc.upperCase("Hello World!"));

res.end();

}).listen(5000);


Run Program using command prompt 

C:\Users\NEW\nodex>node Node.js

output:

Step  1 :open crome tab

Step 2  : type on address bar localhost:5000 and enter 

HELLO WORLD!


second method: to run proram on console side


var uc=require('upper-case');
console.log(uc.upperCase("Hello World!"));

C:\Users\NEW\nodex>node Node.js

output:

 HELLO WORLD!


No comments:

Post a Comment

Slip 10. Write a jQuery code to make first word of each statement to bold.

  Slip 10. Write a jQuery code to make first word of each statement to bold.  <!DOCTYPE html> <html>   <head>     <scri...