I am using node.js webserver. I am also socket.io and webrtc for getting audio streaming in my application. I am rendering a html file from here using a path /audio as shown here.
const webServer = http.createServer(app);
const socketIo = require("socket.io")(webServer); // web socket external module
app.use( '/assets', express.static( path.join( __dirname, 'assets' ) ) );
// Rendering html file
app.get( '/audio', ( req, res ) => {
res.sendFile( __dirname + '/index.html' );
} );
The html file contains CSS and js files an I am loading them as below.
<link rel="stylesheet" href='assets/css/app.css' type="text/css">
<script type="module" src='./assets/js/rtc.js'></script>
<script type="module" src='./assets/js/events.js'></script>
<script type="module" src='./assets/js/autolink.js'></script>
When I am running this html file through /audio, I am unable to load these CSS and JS files. In the console I am getting this mime type error.
I have tried all the solutions that I have got through web. But nothing worked as of now.