I've heared that NodeJS is great for making real-time chat applications and I want to implement a chat on my website. Right now I only have the design so I have to make the back-end code now.
However when I'm using socket.io + express it doesn't work out like it should.
Code from server.js:
var app = require('express')();
var http = require('http').Server(app);
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.php');
});
http.listen(3000, function(){
console.log('listening on *:3000');
});
I simply want to show index.php on localhost:3000, however when I browse to the website it doesn't want to show the page. Instead it downloads the index.php file.
But... If I change the extention of the file to html, so index.html it works. But that is not what I want.
I know there are some smart guys out there that can solve this problem in no time. I've been sitting for a very long time myself trying to sovle it.
via Nabil Hayek
No comments:
Post a Comment