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

169
Views
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 answers
Answer question

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 Report
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!