I want to use connect-jsonrpc but I can't get my node.js app to run. I
have a fairly simple script:

var connect = require('express');

var math = {
    add: function(a, b, fn){

        console.log('add');

        var result = a + b;

        var message = a + " + " + b + " = " + result;

        fn(null, result);
    },
    sub: function(a, b, fn){
        fn(null, a - b);
    }
};

var date = {
    time: function(fn){
        fn(null, new Date().toUTCString());
    }
};

var port = process.env.PORT || 3000;

connect.createServer(
    require('connect-jsonrpc')(math, date)
).listen(port);

console.log('server listening on port ' + port);


The associated package.json is:

{
  "name": "node-example",
  "version": "0.0.1",
  "dependencies": {
    "express": "2.2.0",
    "connect-jsonrpc": "*"
  }
}


When I deploy the app on Heroku I see the following in the logs:

2011-12-15T20:32:07+00:00 heroku[web.1]: State changed from up to
bouncing
2011-12-15T20:32:07+00:00 heroku[web.1]: State changed from bouncing
to created
2011-12-15T20:32:07+00:00 heroku[web.1]: State changed from created to
starting
2011-12-15T20:32:08+00:00 heroku[web.1]: Starting process with command
`node rpc.js`
2011-12-15T20:32:09+00:00 heroku[web.1]: Stopping process with SIGTERM
2011-12-15T20:32:09+00:00 app[web.1]: server listening on port 43825
2011-12-15T20:32:09+00:00 heroku[web.1]: Process exited


The "Process exited" at the end is what concerns me. If I try and test
my service with curl it says "curl: (7) couldn't connect to host".

I have logging set to debug, but I'm not seeing anything insightful. I
suspect it isn't like "connect-rpc" and as such my app isn't starting.

Any help is appreciated.

Thanks
Peter


-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to