Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

171
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda