ExpressJS can not get / route in Openshift, but local works

0

I have a project with the following structure:

server.js
/node_modules
/build
    vendor.js
    main.js
    index.html

I'm using express , and angular 's ui-router .

Within server.js I have the following code:

app.get('/*', function(req, res) {
    res.sendFile(__dirname + '/build/index.html');
});

Within the application, if I use the links to navigate, the routes work, the URL is modified to localhost:8080/hellothere , but if I refresh the page or try to go straight to the absolute URL, I get:

Cannot GET /hellothere

I've tried to put:

app.get('/page1', function(req, res) {
    res.sendFile(__dirname + '/build/index.html');
});

app.get('/page2', function(req, res) {
    res.sendFile(__dirname + '/build/index.html');
});
... 

and the behavior is equal to /hellothere . location: ok, cloud: error.

It works:

front-210diner.rhcloud.com

It does not work.

front-210diner.rhcloud.com/sobre

It works:

link

link

Any idea what's going on here?

original question stackoverflow .com

    
asked by anonymous 11.11.2015 / 02:27

0 answers