node.js - Provide multiple static directories node js with Angular 2 -


im trying create multiple directories creating 2 different url routes in node js.

in nodes index.js

app.use(express.static(__dirname + '/public/admin'));    app.use(express.static(__dirname + '/public/client')); app.use(express.static(__dirname + '/public/'));  app.get('/admin', (req, res) => {     res.sendfile(path.join(__dirname + '/public/admin/index.html')); });  app.get('/order-issue', (req, res) => {     res.sendfile(path.join(__dirname + '/public/admin/index.html')); });   app.get('/client', (req, res) => {     res.sendfile(path.join(__dirname + '/public/client/index.html')); });  app.get('/', (req, res) => {     res.sendfile(path.join(__dirname + '/public/client/index.html')); }); 

but default need /client home page accessed, redirecting /admin page.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -