What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-26 14:16:12
if (req.url === "/script.js")
var http = require('http'); var url = require('url'); var fs = require('fs'); var path = require('path'); http.createServer(function(req, res) { if (req.url === '/') { fs.readFile('./index.html', function(err, data) { if (err){ ... Add solution -
Javascript 2021-10-16 15:55:07
file system replace line js
var fs = require('fs') fs.readFile(someFile, 'utf8', function (err,data) { if (err) { return console.log(err); } var result = data.replace(/string to be replaced/g, 'replacement'); fs.writeFile(someFile, result, 'utf8', function (err) { ... Add solution -
Javascript 2021-10-03 20:04:04
serving html and css with node js
// HTTP Module for Creating Server and Serving Static Files Using Node.js // Static Files: HTML, CSS, JS, Images // Get Complete Source Code from Pabbly.com var http = require('http'); var fs = require('fs'); var path = require('path'); http.createServe... Add solution