I am working on node js, where I have the following directories: C:\wamp64\www\Scrapper
. In the Scrapper
folder, I have:
/Controllers/main.js
/Public/index.html
/server.js
What I did is, I have included the main.js
in the index.html
as:
<script src="/Controllers/main.js"></script>
Also, I have declared these two folders as static in node js server.js
file which is located in the main directory i.e. /Scrapper
. When I run the app, it says:
http://localhost:8080/Controllers/main.js net::ERR_ABORTED 404 (Not Found)
The way I declared the static files in server.js
is :
app.use(express.static(__dirname + "/Public"));
app.use(express.static(__dirname + "/Controllers"));
app.use(body_parser.json());
I don't know what the problem is. All I want is to include the main.js
file in the index.html
. It's a client site script which should run within that folder.