i have routes.js
module.exports = function(app) { //i can't use because angular routing not work /*app.get('*', function(req, res) { res.sendfile('./public/index.html'); });*/ app.get('/submit', function(req,res){ res.sendfile('./public/submit.html'); }); app.get('/schedule', function(req,res){ res.sendfile('./public/schedule.html'); }); app.get('/requests', function(req,res){ res.sendfile('./public/requests.html'); }); app.get('/tv_left', function(req,res){ res.sendfile('./public/tv_left.html'); }); app.get('/tv_center', function(req,res){ res.sendfile('./public/tv_center.html'); }); app.get('/tv_right', function(req,res){ res.sendfile('./public/tv_right.html'); }); app.get('/', function(req, res){ res.sendfile('./public/index.html'); }); }; and approutes.js this
angular.module('approutes', []).config(['$routeprovider', '$locationprovider', function($routeprovider, $locationprovider) { $routeprovider // home page .when('/', { templateurl: 'index.html', controller: 'logincontroller' }) .when('/submit', { templateurl: 'submit.html', controller: 'submitcontroller' }); $locationprovider.html5mode(true); }]); basicly if use app.get('*'), request go index.html, eventhough url changed.
that's because express handles routes in order defined. if want index.html catch-all route, move bottom of function.
further reading: https://www.safaribooksonline.com/blog/2014/03/10/express-js-middleware-demystified/
Comments
Post a Comment