dimanche 1 février 2015

Angular backend routes for non-HTML resources


I'm trying to set up routing using ngRoute in Angular. I know that GET requests to the backend are supposed to return index.html, and then index.html loads Angular, which constructs the appropriate page.


But the problem I'm having is that GET requests to app.js are returning index.html. When I look at other peoples' code and old code of mine, they basically have the same route as me:



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


How are you supposed to handle GET requests for non-HTML resources?





Aucun commentaire:

Enregistrer un commentaire