I am trying to use Chart.js with node.js. I downloaded Chart.js from the following git source: https://github.com/nnnick/Chart.js and tested it with php and things worked fine.
Now I am working with node.js but I have an issue:
Resource interpreted as Script but transferred with MIME type text/html: "url/Chart.js/Chart.js" localhost/:3 Uncaught SyntaxError: Unexpected token < /Chart.js/Chart.js:1
debug.html
<html><head>
<script src="Chart.js/Chart.js"></script>
</head></html>
index.js
var http=require('http');
var fs=require('fs');
var fichier=fs.readFileSync('debug.html', 'utf-8');
var server = http.createServer(function(req,res){
res.writeHead(200, {'Content-Type': 'text/html'});
res.write(fichier);
res.end();
});
server.listen(80);
I know that the path is good, node can find it so what is the problem?
Thank you for helping.
type="text/javascript"on thescripttagChart.js, line #1?http://localhost/Chart.js/Chart.js, you should see that your server always serves the same page for each request, without taking into account the path.