0

I want to (1) create a server from NodeJS, (2) execute an already-developed html file that shows images and utilizes the camera, and (3) show all of that on a localhost

I have tried the below code that can run the html file, but the images do not show.

var http = require('http');
var fs = require('fs');
var serverURL = 'localhost';

fs.readFile('./index.html', function(err,html){
    if (err) throw err;
    http.createServer(function(req,res){
        res.end(html);
    }).listen(490);
})

I would like to run this html file that has several images and utilizes the camera, but none of it shows up. It is only the written information and the image error icon.

  • It's because you're not sending the images to the browser. I don't personally know enough about node.js to elaborate further, but someone may be able to go from here. – markzz Jun 19 '19 at 19:11
  • Possible duplicate of [Node JS not serving the static image](https://stackoverflow.com/questions/40837359/node-js-not-serving-the-static-image) – GalAbra Jun 19 '19 at 19:11

0 Answers0