박권수

set implement line

1 +// const Router = require("koa-router");
2 +// const line = new Router();
3 +// const lineCtrl = require("./line.ctrl");
4 +
5 +// line.post("/register", lineCtrl.message);
6 +
7 +// module.exports = line;
1 +// const TARGET_URL = 'https://api.line.me/v2/bot/message/reply'
2 +// const TOKEN = 'tdN03DyXDAcKGZsuiPndaU7UC2GzuEQYUhPCkDnGWXGGdiPmV15QYbFU1U5JP5EpiETIKLqOmci/RxFZTfD7FRMED0OpT+3qgEYBNf8T9/jRzHRm7rblBLtzFBVOeXeYRcluOsz4koE4JaAJaUtMtwdB04t89/1O/w1cDnyilFU='
3 +// const fs = require('fs');
4 +// const path = require('path');
5 +// const HTTPS = require('https');
6 +// const domain = "www.osstest17.ml"
7 +// const sslport = 3001;
8 +
9 +// exports.message = async(ctx) => {
10 +// var eventObj = req.body.events[0];
11 +// //var source = eventObj.source;
12 +// //var message = eventObj.message;
13 +
14 +// // request log
15 +// console.log('======================', new Date() ,'======================');
16 +// console.log('[request]', req.body);
17 +// console.log('[request source] ', eventObj.source);
18 +// console.log('[request message]', eventObj.message);
19 +
20 +// request.post(
21 +// {
22 +// url: TARGET_URL,
23 +// headers: {
24 +// 'Authorization': `Bearer ${TOKEN}`
25 +// },
26 +// json: {
27 +// "replyToken":eventObj.replyToken,
28 +// "messages":[
29 +// {
30 +// "type":"text",
31 +// "text":"Hello, user"
32 +// },
33 +// {
34 +// "type":"text",
35 +// "text":"May I help you?"
36 +// }
37 +// ]
38 +// }
39 +// },(error, response, body) => {
40 +// console.log(body)
41 +// });
42 +
43 +
44 +// res.sendStatus(200);
45 +// }
46 +
47 +// try {
48 +// const option = {
49 +// ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'),
50 +// key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(),
51 +// cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(),
52 +// };
53 +
54 +// HTTPS.createServer(option, app).listen(sslport, () => {
55 +// console.log(`[HTTPS] Server is started on port ${sslport}`);
56 +// });
57 +// } catch (error) {
58 +// console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
59 +// console.log(error);
60 +// }
61 +
...\ No newline at end of file ...\ No newline at end of file