So i have a html page with some facial recognition libraries on it and it works fine. But when i put the html page on a node.js local server, all the pictures and javascript libraries are not included anymore. For every library include i get an: "Uncaught SyntaxError: Unexpected token <" error, on the first line of the html page.
I tried to include them from within the node.js file like this:
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app)
, fs = require('fs')
, five = require("johnny-five"),
led;
//iets met poort 80
app.listen(80);
// webserver handler
function handler (req, res) {
fs.readFile(__dirname + '/emotie.html',
function (err, data) {
if (err) {
res.writeHead(500);
return res.end('Error loading index.html');
}
res.writeHead(200);
res.end(data);
});
}
function handler (req, res) {
fs.readFile(__dirname + '/js/emotionmodel.js',
function (err, data) {
if (err) {
res.writeHead(500);
return res.end('Error loading emotionmodel.js');
}
res.writeHead(200);
res.end(data);
});
}
function handler (req, res) {
fs.readFile(__dirname + '/js/emotion_classifier.js',
function (err, data) {
if (err) {
res.writeHead(500);
return res.end('Error loading emotionClassifier.js');
}
res.writeHead(200);
res.end(data);
});
}
But it still doesnt work, and the filepath is right for sure.
via fishFishFish
No comments:
Post a Comment