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

128
Views
¿Por qué no se incluyen estilos en index.html en el servidor local?

Usando node.js, abrí el servidor, ¿por qué no muestra los estilos, aunque si solo abre index.html en el navegador, entonces todos los estilos se muestran correctamente, cuál es el problema? índice.html

<!doctipo html>

 <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="style/style.css" type="text/css" /> <title>Socket.IO chat</title> </head>

índice.js

 const express = require('express'); const app = express(); const http = require('http'); const server = http.createServer(app); const port = 3000; app.use(express.static(__dirname + '/style/style.css')); app.get('/', (request, response ) => { response.sendFile(__dirname + '/index.html'); }); server.listen(port, () => { console.log(`listening on port ${port}`); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Usar

 app.use(express.static(__dirname + 'style'));

En cambio. Express.static utiliza directorios. No archivos.

https://expressjs.com/en/starter/static-files.html

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!