This question tightly relates to This issue here.
I'm building an nodeJS app. You can see the file architecture in the screenshot below.
When I try running my index.JS file:
const express = require('express')
const server = new express()
const srcDir = require('app-root-path');
const port = 3000
server.get('/', (req, res) => {
res.sendFile(`${srcDir}/app/views/index.html`)
})
server.listen(port, () => {
console.log(`App listening at http://localhost:${port}`)
})
Issue: I get a blank page, where the console says that everything supplementary in my "app" folder (APART FROM HTML FILES THEMSELVES!) (components (js files), assets (css), e.t.c.) is unreachable: Failed to load resource: the server responded with a status of 404 (Not Found)
. I know that the origin of the issue might be in establishing serve-static (which I don't understand), although it has always worked perfectly without it.
Can anyone help out? Thanks in advance.