Openshift cannot find my css file

I managed to create a new app on Openshift and the main template they provided me works. The only thing I added to this:

<head>
...
<link href="styles.css" rel="stylesheet">
</head>

      

and a styles.css file in the same directory as index.html. In the css file, I just changed the footer to red. When I click on index.html my browser shows the changes, but when I upload the files in Openshift nothing changes and I get:

GET http://bgl-boardgamelab.rhcloud.com/styles.css 404 (Not Found)

      

I think I am making some silly mistake, but I cannot figure out what it is.

+3


source to share


3 answers


It turns out I had to add the following to my function .initializeServer

to serve all of my static files:



self.app.use(express.static(__dirname));

      

+2


source


try it



<link rel='stylesheet' href='styles.css' type='text/css' media='all' />

      

0


source


Try the full path url:

<link href="http://localhost/myproject/styles.css">

      

or

<link href="http://examplesite.com/styles.css">

      

0


source







All Articles