I am using Node to render a page when first visited, but for the life of me I cannot get the javascript file to load correctly. It keeps coming up with a 404 error that the test.js file cannot be found. ("GET http://localhost:8080/Include/test.js ") The page loads correctly, but the window.onload javascript event does not fire.
root/helloworld.js
var express = require('express');
var server = require('http').createServer(app);
var app = express();
app.set('views',__dirname+'/views');
app.set('view engine','jade');
app.get('/',function(req,res){
res.render('index', { title: 'Hey', message: 'Hello!',scripts: [ '/Include/test.js']});
});
app.listen(8080);
root/Include/test.js
window.onload = function () {
alert('Test Passed');
}
root/views/index.jade
html
<head>
-each script in scripts
script(type='text/javascript', src= script)
title!= title
</head>
body
h1!= message