김시환

start

Showing 1 changed file with 41 additions and 0 deletions
1 +const express = require('express');
2 +const app = express();
3 +
4 +app.use(express.urlencoded({ extended: false }));
5 +app.use(express.json());
6 +
7 +app.get('',(req,res)=> {
8 + res.send('tset')
9 +})
10 +
11 +
12 +app.get('/keyboard', (req, res) => {
13 + const data = {'type': 'text'}
14 + res.json(data);
15 +});
16 +
17 +app.post('/message', (req, res) => {
18 + const question = req.body.userRequest.utterance;
19 + const goMain = '처음으로';
20 +
21 + if (question === '테스트') {
22 + const data = {
23 + 'version': '2.0',
24 + 'template': {
25 + 'outputs': [{
26 + 'simpleText': {
27 + 'text': '테스트'
28 + }
29 + }],
30 + 'quickReplies': [{
31 + 'label': goMain,
32 + 'action': 'message',
33 + 'messageText': goMain
34 + }]
35 + }
36 + }
37 + }
38 + res.json(data);
39 +});
40 +
41 +app.listen(3000, () => console.log('node on 3000'));
...\ No newline at end of file ...\ No newline at end of file