Ubuntu

terminate is updated and apikey, token are deleted

Showing 1 changed file with 22 additions and 4 deletions
var express = require('express');
const request = require('request');
const TARGET_URL = 'https://api.line.me/v2/bot/message/reply'
const TOKEN = 'femdVKgBP5AnhQ8aW6Q7I/wQeC2sPoTovRQiaVSMXnbGztImhOtK7q303LV3OFdua9c618XN6cyWVeh5CqL/ItLavtPYbO64FAX8GJZwcS2HpPPFRBmlqZbchKlKAB6NSb1+QZKzOPwMurZpv7wBwQdB04t89/1O/w1cDnyilFU='
const Question_URL = 'https://inspct.career.go.kr/openapi/test/questions?apikey=8f65744f11f9b7e8fc2b7c28617e9d09&q=6'
const TOKEN = ''
const Question_URL = 'https://inspct.career.go.kr/openapi/test/questions?apikey=&q=6'
const Result_URL = 'https://inspct.career.go.kr/openapi/test/report'
const fs = require('fs');
const path = require('path');
......@@ -66,7 +66,7 @@ app.post('/hook', function (req, res) {
request.post({
url:Result_URL,
json:{
"apikey":"8f65744f11f9b7e8fc2b7c28617e9d09",
"apikey":"",
"qestrnSeq":"6",
"trgetSe":"100208",
"gender":"100323",
......@@ -97,7 +97,7 @@ app.post('/hook', function (req, res) {
});
});
}else{
}else if (i>0){
request.get({
url:Question_URL
},function(err,res,body){
......@@ -129,6 +129,24 @@ app.post('/hook', function (req, res) {
});
});
}
}else if (message.text=="종료") {
request.post({
url: TARGET_URL,
headers: {
'Authorization': `Bearer ${TOKEN}`
},
json: {
"replyToken":eventObj.replyToken,
"messages":
{
"type":"text",
"text":"검사를 종료합니다"
}
}
},(error, response, body) => {
console.log("terminated");
i=-1;
});
}
res.sendStatus(200);
});
......