I have an API coded in Nodejs and an AngularJS app statically served by the same server.
I need to host another AngularJS app which should be served by the same server.
How can I do that? Can Restify or Express serve 2 static apps?
I used
server.get(/\/shared\/?.*/, restify.serveStatic({
directory: __dirname + '/shared/.build',
default: 'index.html'
}));
doesn't work if I write
http://127.0.0.1:3000/shared
This should work just fine:
app.use('/app1', express.static(path.join(__dirname, '/app1/.build')))
app.use('/app2', express.static(path.join(__dirname, '/app2/.build')))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.