2016年6月21日 星期二

line chat bot 開發 教學

https://github.com/runnables/line-bot-sdk-nodejs

一下子就在 aws 上run起來了

為了要開發方便,
所以要在本機run
才發現 aws 的方便,
造成了我的不便。

1.ssl 免費的要用
http://wolke-codes.blogspot.tw/2016/01/lets-encrypt-ssl.html
結果 lets encypt 有改版要重抓 卡了一下。

ip分享器不能先https 獨立出來,所以卡了一下。
然後要選 3 。



2.ssl 可以用之後,
運行https
明明在 chrome 上,是正常,
偏偏賴的verfify
一直吐 ssl驗證錯誤,
真是賴。

卡操久,
忽然想說試一下 firefox 居然也是 ssl 驗證錯誤.
最後找到解 firefox的解
也解了 line verfify
完工

var https = require('https')
    ,fs = require("fs");

var options = {
  ca : fs.readFileSync('/etc/letsencrypt/live/xxx.co.uk/chain.pem'), // 差這一M
    key: fs.readFileSync('/etc/letsencrypt/live/xxx.co.uk/privkey.pem'),
    cert: fs.readFileSync('/etc/letsencrypt/live/xxx.co.uk/cert.pem')
};

https.createServer(options, app).listen(443, function () {
    console.log('Https server listening on port ' + 443);
});

沒有留言:

張貼留言