The OpenShift forums have been retired, but you can still read and search them.
For the most up-to-date information about how to use OpenShift please visit

Pictures, css... where can I store resources?


I'm new at openshift and i'm triying to figure out where to place my images, css, javascripts.etc...

You can see the deafult html that OPENSHIFT created by me when i get my NODE.JS cartridge.

I modified the index.html to insert an image (<img src="mydolfer_at_same_level_as_index/mypicture.jpg"" />) and i'm not succeding on in.

You can see:

If I do a find . -name mypicture.jpg at my server (connecting via ssh) i find my images ant app-root/repo. At this folder i can find my index.html, my folder "img", my favicon.ico, etc...

What can I do to make that index.html can use my resources??

Thanks in advance, Regards, Carlos

Add below line into self.initializeServer function from server.js file.

        // serve static assets;

After that you should be able to serve the static files from images directory.


It sounds like express's 'static' middleware may be what you're looking for.

I usually configure static routes on the resulting express application object after running var app = express.createServer():

app.use('/public', express.static(__dirname+'/public'));

To quickly add a list of static folders, I add something like this:

['css', 'img', 'js', 'plugin', 'lib'].forEach(function (dir){
    app.use('/'+dir, express.static(__dirname+'/'+dir));

This example may come in handy:

Thank you Ryan!!!

It helps me!! It works now!! And now i can use my own css, js, plugins, picts...


Regards, Carlos


<img alt="AVBC logo" src="data/img/Marca_AVBC.jpg">

I don't think you have "data/img/Marca_AVBC.jpg"