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
C:\Users\NEW\nodex>node Node.js
output:
HELLO WORLD!
No comments:
Post a Comment