0
Programming my first system I came across a little problem... I am creating a client system and changed the structure of the views folder as follows:
- /app
- /views
- /customers
- ejs customers.
- add ejs.
- /users
- users.
- add ejs.
- /customers
- /views
So far, everything’s perfect, routes, controllers and models. But when I click the button with the "/clients/add" route that leads to "/clients/add.ejs" it loads the ok page, but the Static paths are changed, trying to search in "/clients/css" or "/clients/img", where the right one would be "/css" and "/img".
How do I resolve this issue with multiple pages in views?
/app/Routes/clients.js
module.exports = function(application){
application.get('/clientes', function(req, res){
application.app.controllers.clientes.cadastrar(application, req, res);
});
application.get('/clientes/adicionar', function(req, res){
application.app.controllers.clientes.adicionar(application, req, res);
});
}
/app/controllers/clients.js
module.exports.clientes = function (application, req, res){
res.render('clientes/clientes', {validacao: {}, dadosForm: {}});
}
module.exports.adicionar = function(application, req, res){
res.render('./clientes/adicionar');
}
module.exports.cadastrar = function(application, req, res){
res.send('tudo ok');
}
in the server.js the Static express configuration
app.use(express.static('./app/public'));
I think this problem is on the client side... how are the paths in the HTML links you are generating?
– Sergio