Answer the question
In order to leave comments, you need to log in
How to create admin layout in MEAN correctly?
Hello. In general, there is MEAN which I myself do from scratch using passport. I understood how to register an eccentric, log in and save in cookies.
I can’t understand how I can create a separate layout for the admin panel where there will be another index.html
In express there is a public folder, I created the admin folder in it and pushed another index.html there, created the adminApp module, etc.
In the frontend, when logging in, if express sees that the guy has the admin role in the database, then it returns state === 'toadmin' and then sends it to the admin / enter route, in which, in turn, this code
var path = require('path');
var express = require('express');
var router = express.Router();
module.exports = function(){
router.get('/enter', function(req, res){
res.sendfile('../admin/index.html');
});
return router;
};
Answer the question
In order to leave comments, you need to log in
In express there is a public folder in it created a folder admin
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question