Node.js HTTPS မော်ဂျူး
ဥပမာ
သင့်ကွန်ပျူတာ၏ port 8080 တွင် နားထောင်နိုင်သော https ဆာဗာတစ်ခု ဖန်တီးပါ။
port 8080 ကိုဝင်ရောက်သည့်အခါ "Hello World!" ဟုရေးပါ။ တုန့်ပြန်မှုအဖြစ်
var https = require('https');
https.createServer(function (req, res)
{
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello World!');
res.end();
}).listen(8080);
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
HTTPS မော်ဂျူးသည် လုံခြုံသော HTTP ပရိုတိုကောဖြစ်သည့် HTTP TLS/SSL ပရိုတိုကောတွင် Node.js ဒေတာလွှဲပြောင်းခြင်းကို ပြုလုပ်သည့်နည်းလမ်းကို ပံ့ပိုးပေးသည်။
အထားအသို
သင့်အပလီကေးရှင်းတွင် HTTPS module အပါအဝင် အထားအသို-
var https = require('https');
HTTPS ဂုဏ်သတ္တိများနှင့် နည်းလမ်းများ
Method | Description |
---|---|
createServer() | Creates an HTTPS server |
get() | Sets the method to GET, and returns an object containing the user's request |
globalAgent | Returns the HTTPS Agent |
request | Makes a request to a secure web server |