Aplicación MEAN con panel de administración y panel de cliente

Tengo una aplicación media que funciona perfectamente con el panel de administración.

Mi servidor está escuchando en: http: // localhost: 3003

panel de administración al que puedo acceder aquí: http: // localhost: 3003 / # / admin /

Ahora quiero separar el panel de administración y el panel de cliente, pero el panel de cliente no es accesible, como cuando intenté esta URL, no mostrar nada

http: // localhost: 3003 / # / cliente

He actualizado mi archivo server.js y también habilito varias vistas en Express v 10.xx como:

app.set('views', [__dirname + '/admin/views', __dirname + '/client/views']);

Creo que el problema esta con

app.get('/', function (req, res) { res.render('index.html'); });

Procesa admin / index.html cada vez.

¡Aquí está mi estructura de directorio!

 mean-app ----admin | -----js | ---controllers ---app.js -----views | ---partials ---index.html ----client | -----js | ---controllers ---app.js -----views | ---partials ---index.html config controllers services models node_modules services bower_components package.json bower.json server.js 

aquí está mi server.js

 var express = require('express'); var app = express(); var bodyParser = require('body-parser'); var mongoose = require('mongoose'); var apiRoutes = require('./config/api-routes'); var auth = require('./config/authorization'); app.set('views', [__dirname + '/admin/views', __dirname + '/client/views']); app.engine('html', require('ejs').renderFile); app.use(bodyParser.urlencoded({extended:true})); app.use(bodyParser.json()); var dbUrl = process.env.MONGOLAB_URI || "mongodb://127.0.0.1:27017/ecommerce-app-db"; var port = process.env.PORT || 3003; mongoose.connect(dbUrl); app.listen(port, function(){ console.log('Listening on port ' + port); }); app.get('/', function (req, res) { res.render('index.html'); }); app.get('/partials/:name', function (req, res) { console.log(req.params.name); res.render('partials/' + req.params.name); }); app.use('/adminjs', express.static(__dirname + '/admin/js')); app.use('/clientjs', express.static(__dirname + '/client/js')); app.use('/bower_components', express.static(__dirname + '/bower_components')); app.use('/images', express.static(__dirname+'/uploads/')); // Load Api routes apiRoutes(app, auth); 

Admin app.js

 var adminApp = angular.module('adminApp', [...]); adminApp.constant('SERVERURL', 'http://localhost:3003'); adminApp.config(['$routeProvider', function($routeProvider){ $routeProvider .when('/admin', { redirectTo: '/admin/dashboard' }) .when('/admin/dashboard', { templateUrl: 'partials/dashboard.html', controller: 'MainCtrl' }) .otherwise({ redirectTo: '/admin' }); }]); 

Cliente app.js

 var clientApp = angular.module('clientApp', [...]); clientApp.constant('AppConfig', { 'APP_NAME' : 'Web Shop', 'SERVERURL': 'http://localhost:3003', 'META_TITLE': 'Web Shop' }); clientApp.config(function ($routeProvider, $locationProvider) { $routeProvider .when('/client', { templateUrl: 'partials/main.html', controller: 'MainCtrl' }) .otherwise({ redirectTo: '/client' }); // prevent preflight request for cross-domain Ajax calls $httpProvider.defaults.useXDomain = true; delete $httpProvider.defaults.headers.common['X-Requested-With']; }); 

Cliente index.html

       

Bueno, vine con una solución, espero que ayude a alguien.

La estructura del directorio permanece como se muestra en la pregunta, aquí está mi server.js

 var express = require('express'); var app = express(); var bodyParser = require('body-parser'); var mongoose = require('mongoose'); var apiRoutes = require('./config/api-routes'); var auth = require('./config/authorization'); app.set('views', __dirname); app.engine('html', require('ejs').renderFile); //Add middleware necessory for Rest API's app.use(bodyParser.urlencoded({extended:true})); app.use(bodyParser.json()); // CORS Support app.use(function(req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); res.header('Access-Control-Allow-Headers', 'Content-Type'); // var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress; //console.log('Client IP:', ip); next(); }); var dbUrl = process.env.MONGOLAB_URI || "mongodb://127.0.0.1:27017/ecommerce-app-db"; var port = process.env.PORT || 3003; mongoose.connect(dbUrl); app.listen(port, function(){ console.log('Listening on port ' + port); }); app.get('/admin', function (req, res) { res.render('admin/views/index.html'); }); app.get('/client', function (req, res) { res.render('client/views/index.html'); }); app.get('/admin/partials/:name', function (req, res) { res.render('admin/views/partials/' + req.params.name); }); app.get('/client/partials/:name', function (req, res) { res.render('client/views/partials/' + req.params.name); }); app.use('/admin/adminjs', express.static(__dirname + '/admin/js')); app.use('/client/clientjs', express.static(__dirname + '/client/js')); app.use('/admin/bower_components', express.static(__dirname + '/bower_components')); app.use('/client/bower_components', express.static(__dirname + '/bower_components')); app.use('/images', express.static(__dirname+'/uploads/')); // Load Api routes apiRoutes(app, auth); 

Aquí está mi aplicación admin.js

 var adminApp = angular.module('adminApp', [....]); adminApp.constant('SERVERURL', 'http://localhost:3003'); adminApp.config(['$routeProvider', function($routeProvider){ $routeProvider .when('/admin', { redirectTo: '/admin/dashboard' }) .when('/admin/dashboard', { templateUrl: 'partials/dashboard.html', controller: 'MainCtrl' }) .otherwise({ redirectTo: '/' }); }]); 

aquí es admin index.html

     Web Shop Admin     

Aquí está el cliente app.js

 var clientApp = angular.module('clientApp', [...]); clientApp.config(function ($routeProvider, $locationProvider) { $routeProvider .when('/', { templateUrl: 'partials/main.html', controller: 'MainCtrl' }) .otherwise({ redirectTo: '/client' }); }); 

Aquí está el cliente index.html

      Web Shop Admin