In my routes.js file, I have set up various routes for different pages like submit.html and schedule.html. However, I encountered an issue where angular routing does not work properly when using app.get('*'). This meant that any request would default back to index.html even if the URL had changed.
module.exports = function(app) {
app.get('/submit', function(req,res){
res.sendfile('./public/submit.html');
});
app.get('/schedule', function(req,res){
res.sendfile('./public/schedule.html');
});
// Other route configurations...
app.get('/', function(req, res){
res.sendfile('./public/index.html');
});
};
In addition to my routes.js, I also have an appRoutes.js file which handles the AngularJS routing. Here is an example:
angular.module('appRoutes', []).config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'index.html',
controller: 'LoginController'
})
.when('/submit', {
templateUrl: 'submit.html',
controller: 'SubmitController'
});
$locationProvider.html5Mode(true);
}]);