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));
node.js – JavaScript file net::ERR_ABORTED 404 (Not Found)
html – net::ERR_ABORTED 404 when loading javascript from Spring Boot
Related Posts
- Running Python on Windows for Node.js dependencies
- How do I make TreeNode from list by Python
- node.js – npm – Cant find Python executable python, you can set the PYTHON env variable.
- linked list – Python Logic of ListNode in Leetcode
- How to call a Python function from Node.js
- node.js – How to use a different version of python during NPM install?
- debugging – How do I debug Error: spawn ENOENT on node.js?
- Node.js: Python not found exception due to node-sass and node-gyp