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:
It does not work.
front-210diner.rhcloud.com/sobre
It works:
Any idea what's going on here?