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
Post a Comment