V
V
Vlad Timofeev2014-11-06 22:23:09
Node.js
Vlad Timofeev, 2014-11-06 22:23:09

Why don't styles work after running through Localhost?

There is a site layout with this structure:
a38837ef6c90441cbb289047c5cdfff4.png
But when I run through the node (server.js) Only html is loaded + The page cannot find directory files:
ff3d49e4e1e346f195c5c2c91b36dd39.png
--------------------- -------------------------------------------------- -
server.js :

var app = require('express')(),
  http = require('http').Server(app),
  io = require('socket.io')(http);

app.get('/', function(req, res){
  res.sendFile(__dirname + '/index.html');
});

io.on('connection', function(socket){
  console.log('Someone connected!');
  socket.on('chat message', function(msg){
    io.emit('chat message', msg);
    console.log('someone chated: ' + msg);
  });
  socket.on('disconnect', function(){
    console.log('someone Disconnected');
  });
});

http.listen(3000, function(){
  console.log('Listening on port 3000')
});

Style links:
<link rel="stylesheet" href="styles/main.css">
  <link rel="stylesheet" href="styles/phone.css">

-------------------------------------------------- ----------------------
What actually to do? =(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
chywafvy afa, 2014-11-06
@PyTiMa

Install expressjs.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question