HomeAuthorsContact

File's in node server

By Bikash Dash
Published in NodeJS
May 15, 2021
1 min read

How to read file in NodeJS ?

to access file in NodeJS we need file System module (fs) example: require(‘fs’)

const http = require('http');
const fs   = require("fs");


http.createServer(function (req, res, next) {
  fs.readFile('index.html',(err, data) => {
    res.write(data);
    return res.end();
  })
}).listen('8080')

Bikash Dash

Bikash Dash

Full Stack Developer

Full Stack Developer at Defraudit.pvt.ltd

Expertise

nodejs
react

Social Media

instagramtwitterwebsite

Related Posts

NodeJS
what is NodeJs url module
May 15, 2021
1 min
© 2021, All Rights Reserved.

Quick Links

Advertise with usAbout UsContact Us

Social Media