app.js
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const Address = require('./Address.js');
const express = require('express');
const app = express();
console.log(Address.getAddress('석수동길'));
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
app.get('',(req,res)=> {
res.send('tset')
})
app.post('/hook', function(request,response){
var eventObj = request.body.events[0];
console.log("---------------",new Date(),"-----------------");
response.sendStatus(200);
})
app.get('/keyboard', (req, res) => {
const data = {'type': 'text'}
res.json(data);
});
app.post('/message', (req, res) => {
const question = req.body.userRequest.utterance;
const goMain = '처음으로';
if (question === '테스트') {
const data = {
'version': '2.0',
'template': {
'outputs': [{
'simpleText': {
'text': '테스트'
}
}],
'quickReplies': [{
'label': goMain,
'action': 'message',
'messageText': goMain
}]
}
}
}
res.json(data);
});
app.listen(3000, () => console.log('node on 3000'));