Reputation: 1235
I am facing error "file not found" in an angular javascript. I am using Nodejs and express for server and angularjs in html5. AngularChart.html is in "public" folder in which I am trying to refer one javascript in one level up.
script type="text/javascript" src="../check.js"
It is giving me the error in console.
GET http://localhost:3000/check.js 404 (Not Found)
Here is my folder structure.
\myapp\public\AngularChart.html
\myapp\check.js
it works when in refer files folder down but nothing working in folder up. I suspect it may be because of the __dirname in app.js which is as below.
var express = require('express');
var app = express();
app.use(express.static(path.join(__dirname, 'public')));
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'html');
Please help.
Thanks
Upvotes: 0
Views: 1421
Reputation: 3194
Your chart.js should be public so add it inside the public directory otherwise it gives a 404 error (Not found) since it is not visible to the client.(browser)
Upvotes: 1