I made an angular(2+) app hosted in aws ec2 using bitnami MEAN stack. Everything is working fine, except angular reloading which is giving 404. I know that angular is a SPA(Single Page Application), so we need to send index.html file everytime(that's why we're getting this error). So, I did some research and find this code for nodejs and I wrote this after all routes:
app.use('*', (req, res, next) => {
res.sendFile(filePath);
})
But, I got nothing to display in browser and what I got in browser console was:
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
Note: I know about hashes in angular, and I don't wanna use those, I want some server configuration.