I am new node.js developer.
I am trying to send data from node server to other node server that listening on port 3003, using restify createJsinClient.
It seems like the call is never being invoked - I can't see it on the server, and on the other side I don't get any error (although I have an error handler).
sender = restify.createJsonClient({localhost:3003, version: '*'});
sender.post(sender.url, {userName: user, ID: id}, function (err) {
if (err) {
console.error(err);
}
console.log("user - %s sent. ", user)
});
and on my client side, I'm having:
let express = require('express');
let app = express();
app.post('/', function (){
console.log ('new user');
});
I can't see any indicator in the client, nor on the sever.
restify.createJsonClient({localhost:3003, version: '*'});
This looks like a javascript object with
localhost
as key and3003
as value.API guide suggests a different format. You can try this instead