-
Notifications
You must be signed in to change notification settings - Fork 15
Node API 설정
Yun edited this page Feb 17, 2017
·
1 revision
router.get('/keyboard', (req, res) => {
const menu = {
type: 'buttons',
buttons: ["메뉴2", "메뉴2", "메뉴3"]
};
res.set({
'content-type': 'application/json'
}).send(JSON.stringify(menu));
});
{
"type": "buttons",
"buttons": [
"메뉴1",
"메뉴2",
"메뉴3"
]
}
router.post('/message', (req, res) => {
const _obj = {
user_key: req.body.user_key,
type: req.body.type,
content: req.body.content
};
let massage = {
"message": {
"text": '응답 메세지...'
},
"keyboard": {
"type": "buttons",
"buttons": [
"메뉴1",
"메뉴2",
"메뉴3"
]
}
};
res.set({
'content-type': 'application/json'
}).send(JSON.stringify(massage));
});
{
"message": {
"text": '응답 메세지...'
},
"keyboard": {
"type": "buttons",
"buttons": [
"메뉴1",
"메뉴2",
"메뉴3"
]
}
}
router.post('/friend', (req, res) => {
const
user_key = req.body.user_key;
console.log(`${user_key}님이 쳇팅방에 참가했습니다.`);
res.set({
'content-type': 'application/json'
}).send(JSON.stringify({success:true}));
});
router.delete('/chat_room/:user_key', (req, res) => {
const user_key = req.params.user_key;
console.log(`${user_key}님이 쳇팅방에서 나갔습니다.`);
res.set({
'content-type': 'application/json'
}).send(JSON.stringify({success:true}));
});