Nathan Campos
Nathan Campos

Reputation: 29507

Now.js Won't Send The Client-Side Javascript

I'm trying to test now.js with the following code:

var connect = require("connect");
var nowjs = require("now");
var io = require("socket.io");

var app = connect().use(connect.static(__dirname + '/public'));

app.listen(8180);

var nowIni = nowjs.initialize(app);

On the HTML side I'm referencing to it on the <head> like this:

<script src="/nowjs/now.js" type="text/javascript"></script>

The problem is that when I access the page on my browser I get this on the Error Console:

GET http://192.168.1.78:8180/nowjs/now.js 404 (Not Found)

What am I doing wrong? How to correct this?

Upvotes: 0

Views: 447

Answers (1)

Vadim Baryshev
Vadim Baryshev

Reputation: 26219

If you use connect 2.0 this code should work fine:

var connect = require("connect");
var nowjs = require("now");
var http = require("http");
var io = require("socket.io");

var app = connect();
app.use(connect.static(__dirname + '/public'));

var httpApp =  http.createServer(app).listen(8180);

var nowIni = nowjs.initialize(httpApp);

Upvotes: 1

Related Questions