Routing in files in separate directories express

0

Well I'm having a problem, I'm trying to render a html page, but I do not want to use any 'view engine' for this, but I can not make my routes that are in a separate directory rendered in my app file. js that are in the root know how I can do this?

NOTE: To render my page I have to load 3 different directories because they have folders with css javascript and bootstrap files Thank you very much.

// codigp app.js

const express = require('express');
const app = express();

app.use(require('./src/backend/routes/routes.js'));

app.listen(3000, () => {
console.log('Servidor ok');
});

// route code in ./src/backend/routes/routes.js

const express = require('express');
const app = express();

app.use(express.static(__dirname + '/content');
app.use(express.static(__dirname + '/src/frontend/img');
app.use(express.static(__dirname + '/src/frontend/');

app.get('/', (req, res) => {

res.sennFile(__dirname + '/src/frontend/html/home.html');

});

module.exports = app;
    
asked by anonymous 08.11.2018 / 21:14

0 answers