은승우

Update app.js

Showing 1 changed file with 7 additions and 6 deletions
......@@ -86,11 +86,6 @@ async function handleEvent(event) {
.then((stream) => {
stream.on('data', (chunk) => {
console.log(chunk);
});
stream.on('error', (err) => {
// error handling
});
});
var cheerio = require('cheerio');
let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
......@@ -108,7 +103,7 @@ async function handleEvent(event) {
'Content-Type': 'application/octet-stream',
'Ocp-Apim-Subscription-Key': subscriptionKey
},
body: event.message.image
body: chunk
};
await request.post(options, function (error, response, body) {
......@@ -148,6 +143,12 @@ async function handleEvent(event) {
client.replyMessage(event.replyToken,result).then(resolve).catch(reject);
});
});
});
stream.on('error', (err) => {
// error handling
});
});
})
}
else if(event.type == 'message' && event.message.type == 'text')
......