Thursday, 11 July 2019

How to add txt file in a folder using node js


var fs = require('fs');
fs.writeFileSync('notes.txt',Hello Iam Rajashree);







Go to cmd prompt < node app.js






Click notes.txt file you View the output in notes.txt








Append a message in notes.txt

var fs = require('fs');
fs.appendFileSync('notes.txt', '|| 'Thanks for Watching ');
 





Out put









Tuesday, 2 July 2019

How to Create server in node js


step1: Create one folder nodeserver > install package.json 
step2: Create new file index.js ==> in index.js type the following code

const http = require('http');
const hostname ="localhost"';
const port = 3000;
const server = http.createServer((req,res) => {
   console.log(req.headers);
   res.statusCode = 200;
   res.setHeader('Content-Type','text/html');
   res.end('<html><body><h1> Server Connect </h1></body></html>');   

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


Step 3 : Add script "start" :"node index";


Step 4 :  Run the server in commandprompt

Output 

Step 5 : Check in Webbrowser 


SEO introduction

What is SEO? SEO(Search Engine Optimization ) is a technique that helps to bring the Website on top. Seo depends on the Keyword . Ke...