E
E
embiid2019-11-13 13:21:55
Node.js
embiid, 2019-11-13 13:21:55

How to connect js/css files to NodeJS?

There is such a hierarchy of files:
5dcbd88763da5974797807.png
I want to include css, js files in layout.ejs

<link rel = "stylesheet" type = "text/css" href = "../style/table.css" />
    <link rel = "stylesheet" type = "text/css" href = "../style/editModal.css" />
    <script src="https://unpkg.com/@ag-grid-enterprise/[email protected]/dist/ag-grid-enterprise.min.js"></script>
    <script src="../javaScript/table.js"></script>

But it doesn't work, it reads the page, but without styles and without js.
Here is what I have on the main server file:
app.set('views', __dirname + '/views/layouts');
app.set("view engine", "ejs")

app.use(express.static(path.join(__dirname, 'views')));

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question