Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

271
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda