I have the following basic folder structure:
main_folder
├──web
│ ├──files_located_here
│ │ ├──dog.jpg
│ │ ├──cat.jpg
│ │ ├──bat.jpg
│ │ └──rat.jpg
│ ├──app.js
│ ├──package.json
│ └──package-lock.json
inside app.js
I have this:
const CORS = require('cors');
const EXPR = require('express');
const app = EXPR();
const router = EXPR.Router();
app
.use(CORS())
.use('/', router)
.use(EXPR.urlencoded({ extended: false }));
router.get('/', (req, res) => {
req.accepts(['json', 'text'])
res.setHeader('content-type', 'text/html')
res.json("sup")
});
app.listen(12, () =>
console.log("ctrl + click => http://123.123.0.12:12/"));
This will render just fine. But if I try navigating to http://123.123.0.12:12/files_located_here/cat.jpg
I get Cannot GET /files_located_here/cat.jpg
.
What I don't understand is, I followed these instructions and it works as expected when windows is hosting the app. But when I use regular folder it won't navigate to the folder. I have tried EXPR.static
and that didn't work. Is this a permission issue? Could it be the server has not been set up to allowing web access?