हां, आप इसे नियमित रूप से कर सकते हैं, यहां नियमित https अनुरोध का उपयोग करके किया गया है;
var https = require('https'), // Module for https
fs = require('fs'); // Required to read certs and keys
var options = {
key: fs.readFileSync('ssl/client.key'), // Secret client key
cert: fs.readFileSync('ssl/client.crt'), // Public client key
// rejectUnauthorized: false, // Used for self signed server
host: "rest.localhost", // Server hostname
port: 8443 // Server port
};
callback = function(response) {
var str = '';
response.on('data', function (chunk) {
str += chunk;
});
response.on('end', function() {
console.log(str);
});
}
https.request(options, callback).end();
स्रोत
2014-05-10 07:33:05
यदि मैं इस दृष्टिकोण का उपयोग करता हूं तो मैं अनुरोध निकाय में JSON या XML कैसे पास करूं? –
@AnandDivakaran यदि आपको पोस्ट अनुरोध के लिए पूर्ण कोड की आवश्यकता है, [यह उत्तर] (http://stackoverflow.com/a/6158966/477878) दिखाता है कि यह कैसे करें। इस मामले में, आपको केवल 'http' के साथ' http' को प्रतिस्थापित करने की आवश्यकता होगी और क्लाइंट प्रमाणपत्रों के लिए काम करने के लिए 'post_options' पर ऊपर दिखाए गए कुंजी और प्रमाणपत्र विकल्प जोड़े जाएंगे। –
धन्यवाद; मैं सुई में आया और यह मेरे लिए काम किया –