how can node js file be serve
app.use('/static', express.static(path.join(__dirname, 'public')))
var fs = require('fs'),
http = require('http');
http.createServer(function (req, res) {
fs.readFile(__dirname + req.url, function (err,data) {
if (err) {
res.writeHead(404);
res.end(JSON.stringify(err));
return;
}
res.writeHead(200);
res.end(data);
});
}).listen(8080);app.use(express.static('public'))
app.use(express.static('files'))
Also in JavaScript:
- chroma js contrast check
- click binding angular 8
- how to take input from form and display in javascript
- express example using puppeteer
- javascript get width of a div
- get params from route vuejs
- how to refresh the page using react
- how to change mui ripple color
- js get first element by class
- document is not defined javascript in nuxt js
- how to call function on every keypress in jquery
- how to send message to specific client using ws node js
- how to loop code in javascript
- javascript replace vowel
- multiple case switch javascript
- repeat a function javascript
- NameError: name 'jsonify' is not defined
- if between two numbers javascript
- merge array in js
- rotation in p5 play
- how to make a 4 dimensional array in JavaScript
- electron remove default menu
- puppeteer example nodejs
- jqeury cdn