Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
Problem with mime type while rendering html file from node.js

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.

Console errors

I have tried all the solutions that I have got through web. But nothing worked as of now.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!