app.js
884 Bytes
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
var express = require('express');
var http = require('http');
var bodyParser = require('body-parser');
var app = express();
app.get('/keyboard', function(req,res){
var data ={
'type': 'buttons',
'buttons': ['질문','컬러','정보']
};
res.json(data);
});
app.use(bodyParser.urlencoded({extended:false}));
app.use(bodyParser.json());
app.post('/message',function(req,res){
var msg = req.body.content;
console.log('전달받은 메세지: '+msg);
var send ={};
switch(msg){
case 'pink':
send = {
}
break;
case 'orange':
send ={
}
break;
default:
send = {
}
break;
}
res.json(send);
})
http.createServer(app).listen(9090,function(){
console.log('서버실행중..');
});