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

The SDK directory does not exist (ubuntu 16.04) (react native) -

python - How to clone or copy a list? -

Convert excel to pdf with VBScript -