Skip to content
Permalink
Browse files

Adding the conditional framework support

  • Loading branch information
liorkesos authored and AvrahamO committed Sep 26, 2018
1 parent dc4c687 commit f527d45b7215d64248aa8753825d62ea54acd889
Showing with 3,713 additions and 86 deletions.
  1. +1 −0 package.json
  2. +1 −0 server/config/config.js
  3. +19 −3 server/config/express.js
  4. +1 −0 src-react
  5. +3,691 −83 yarn.lock
@@ -55,6 +55,7 @@
"rxjs": "6.2.0",
"rxjs-compat": "^6.0.0-rc.0",
"swagger-ui-express": "^3.0.9",
"material-dashboard-react":"latest",
"zone.js": "0.8.26"
},
"devDependencies": {
@@ -35,6 +35,7 @@ const config = {
port: envVars.SERVER_PORT,
mongooseDebug: envVars.MONGOOSE_DEBUG,
jwtSecret: envVars.JWT_SECRET,
frontend: envVars.MEAN_FRONTEND || 'angular',
mongo: {
host: envVars.MONGO_HOST,
port: envVars.MONGO_PORT
@@ -20,12 +20,28 @@ if (config.env === 'development') {
app.use(logger('dev'));
}

// Angular 5 server
app.use(express.static(path.join(__dirname, '../../dist')))
// Choose what fronten framework to serve the dist from
var distDir = '../../dist/';
if (config.frontend == 'react'){
distDir ='../../node_modules/material-dashboard-react/dist'
}else{
distDir ='../../dist/' ;
}

//
app.use(express.static(path.join(__dirname, distDir)))
app.use(/^((?!(api)).)*/, (req, res) => {
res.sendFile(path.join(__dirname, '../../dist/index.html'));
res.sendFile(path.join(__dirname, distDir + '/index.html'));
});

console.log(distDir);
//React server
app.use(express.static(path.join(__dirname, '../../node_modules/material-dashboard-react/dist')))
app.use(/^((?!(api)).)*/, (req, res) => {
res.sendFile(path.join(__dirname, '../../dist/index.html'));
});


app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

0 comments on commit f527d45

Please sign in to comment.
You can’t perform that action at this time.