은승우

Update app.js

Showing 1 changed file with 3 additions and 8 deletions
...@@ -54,7 +54,7 @@ const client = new line.Client(config); ...@@ -54,7 +54,7 @@ const client = new line.Client(config);
54 // register a webhook handler with middleware 54 // register a webhook handler with middleware
55 // about the middleware, please refer to doc 55 // about the middleware, please refer to doc
56 56
57 -/* 57 +
58 app.post('/webhook', line.middleware(config), (req, res) => { 58 app.post('/webhook', line.middleware(config), (req, res) => {
59 console.log(res.statusCode); 59 console.log(res.statusCode);
60 Promise 60 Promise
...@@ -76,7 +76,7 @@ function handleEvent(event) { ...@@ -76,7 +76,7 @@ function handleEvent(event) {
76 headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret} 76 headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret}
77 }; 77 };
78 //papago 언어 감지 78 //papago 언어 감지
79 - request.post(detect_options,function(error,response,body){ 79 + request.post(detect_options,async (error,response,body)=>{
80 console.log(response.statusCode); 80 console.log(response.statusCode);
81 if(!error && response.statusCode == 200){ 81 if(!error && response.statusCode == 200){
82 var detect_body = JSON.parse(response.body); 82 var detect_body = JSON.parse(response.body);
...@@ -101,7 +101,7 @@ function handleEvent(event) { ...@@ -101,7 +101,7 @@ function handleEvent(event) {
101 }; 101 };
102 102
103 // Naver Post API 103 // Naver Post API
104 - request.post(options, function(error, response, body){ 104 + await request.post(options, function(error, response, body){
105 // Translate API Sucess 105 // Translate API Sucess
106 if(!error && response.statusCode == 200){ 106 if(!error && response.statusCode == 200){
107 // JSON 107 // JSON
...@@ -131,8 +131,3 @@ function handleEvent(event) { ...@@ -131,8 +131,3 @@ function handleEvent(event) {
131 }); 131 });
132 } 132 }
133 133
134 -*/
135 -
136 -app.get('/',(req,res)=>{
137 - res.send("hellow world");
138 -})
...\ No newline at end of file ...\ No newline at end of file
......