简体   繁体   中英

How to run multiple yo angular-fullstack applications on same server and port?

I have a development server where I test my applications. I want to simultaneously run multiple yo angular-fullstack applications on that server in different sub-directeries. Eg: example.com/project1 should take me to first project and example.com/project2 should take me to second project. I tried creating an express application at root level and running that after adding separate route for each project like, app.use('/project1', require('project1')); but it's not working because the compressed js and css files are not getting included.

// REQUIRE
var path = require('path');

/* ... */

// ROUTES
app.get('/PROJ-1', function (req, res, next) {
  res.sendFile(path.resolve(__dirname, 'PROJECT-1-PATH', 'index.html'));
});

app.get('/PROJ-2', function (req, res, next) {
  res.sendFile(path.resolve(__dirname, 'PROJECT-2-PATH', 'index.html'));
});

I think this will works..

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM