node.js – JavaScript file net::ERR_ABORTED 404 (Not Found)
node.js – JavaScript file net::ERR_ABORTED 404 (Not Found)
The problem I noticed here is this line app.use(express.static(../../project));
What you are doing is setting the folder project
to public. Your JS files are inside a static folder, and they do not get read. I would suggest the following structure:
project
server.js
static (folder)
HTML (folder for all HTML files)
css (folder for all css files)
js (folder for all js files)
Then in your server.js
file:
const express = require(express);
const app = express();
app.set(view engine, ejs);
app.use(express.static(./static));