Can't include scripts/css on AppFog Node App

41 Views Asked by At

I'm trying to create a Node App with AppFog, I started by including the index.html in my app.js

var http = require('http'),
fs = require('fs');


fs.readFile('./index.html', function (err, html) {
    if (err) {
        throw err; 
    }       
    http.createServer(function(request, response) {  
        response.writeHeader(200, {"Content-Type": "text/html"});  
        response.write(html);  
        response.end();  
    }).listen(8000);
});

The index is then including scripts and css

<!-- jQuery -->
<script src="script/jquery-2.1.1.min.js" type="text/javascript"></script>
<script src="base.js" type="text/javascript"></script>
<!-- Bootstrap -->
<script src="Bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="Bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="Bootstrap/css/bootstrap-theme.min.css">
<!-- Main CSS -->
<link rel="stylesheet" href="main.css">

The index.html is loading properly but the scripts and the styles aren't. The site is THIS if you want to check, from the console you can see that each file returns the index.html instead of the JS code or CSS style.

1

There are 1 best solutions below

0
On

I solved it by using Express NodeJS Framework and let him redirect the user to the correct page.