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

170
Visualizações
Converting html with css and js code pages into a node js application

I have multiple HTML pages with CSS and js files that work(if I open an HTML page on its own using chrome for example) I have tried to use these pages inside a node js project I created. but for some reason, it doesn't recognize the js file and doesn't apply the CSS design. I had installed path, but I still can't get node js to recognize the js file. I'm referring to the js file inside the HTML code by

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need to let the node know that you want to use these files in your project. Or you have to get permission to use these files from the node.

  1. To do this, create a directory called 'public' in the root path of your project

  2. And use the following code in the main file of your project

     const path = require('path');
    
     const express = require('express');
    
     app.use(express.static(path.join(__dirname, 'public')))
    

The above code means that any file in the public folder (such as js css img) is allowed to access and use

about 4 years ago · Juan Pablo Isaza Relatório
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