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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -