정민혁

kakao keyboard api router fixed

...@@ -41,3 +41,5 @@ app.use(function(err, req, res, next) { ...@@ -41,3 +41,5 @@ app.use(function(err, req, res, next) {
41 }); 41 });
42 42
43 module.exports = app; 43 module.exports = app;
44 +app.listen(3000, function(){
45 +});
......
1 var express = require('express'); 1 var express = require('express');
2 var router = express.Router(); 2 var router = express.Router();
3 3
4 -/* GET users listing. */ 4 +
5 -router.get('/keyboard', function(req, res, next) { 5 +router.get('/', function(req, res) {
6 -//메뉴 6 + const choice = {
7 - var choice = { 7 + type: "buttons",
8 - "type":"buttons", 8 + buttons: ["설정", "번역","사전"]
9 - "buttons": ["설정", "번역","사전"]
10 }; 9 };
11 - res.set({ 10 + res.status(200).set({
12 'content-type': 'application/json' 11 'content-type': 'application/json'
13 - }).send(JSON.stringigy(choice)); 12 + }).send(JSON.stringify(choice));
14 }); 13 });
15 14
16 module.exports = router; 15 module.exports = router;
......
...@@ -2,8 +2,8 @@ var express = require('express'); ...@@ -2,8 +2,8 @@ var express = require('express');
2 var router = express.Router(); 2 var router = express.Router();
3 var bodyparser = require('body-parser'); 3 var bodyparser = require('body-parser');
4 4
5 -app.use(bodyparser.urlencoded({extended: false})); 5 +router.use(bodyparser.urlencoded({extended: false}));
6 -app.use(bodyparser.json()); 6 +router.use(bodyparser.json());
7 7
8 router.post('/message', function(req, res, next) { 8 router.post('/message', function(req, res, next) {
9 var user_key = req.body.user_key; 9 var user_key = req.body.user_key;
...@@ -40,8 +40,6 @@ router.post('/message', function(req, res, next) { ...@@ -40,8 +40,6 @@ router.post('/message', function(req, res, next) {
40 40
41 break; 41 break;
42 } 42 }
43 - }
44 - };
45 res.json(msg); 43 res.json(msg);
46 }); 44 });
47 45
......