Showing
2 changed files
with
35 additions
and
40 deletions
| ... | @@ -7,50 +7,47 @@ const apiRouter = express.Router(); | ... | @@ -7,50 +7,47 @@ const apiRouter = express.Router(); |
| 7 | 7 | ||
| 8 | app.use(logger('dev', {})); | 8 | app.use(logger('dev', {})); |
| 9 | app.use(bodyParser.json()); | 9 | app.use(bodyParser.json()); |
| 10 | -app.use('/api', apiRouter); | 10 | +app.use(bodyParser.urlencoded({ |
| 11 | + extended: true | ||
| 12 | +})); | ||
| 11 | 13 | ||
| 12 | -apiRouter.post('/champion', function(req,res) { | 14 | +app.use('/api', apiRouter); |
| 13 | - res.send("Hello,world!"); | ||
| 14 | - /* | ||
| 15 | - const responsebody = { | ||
| 16 | 15 | ||
| 17 | - "version": "2.0", | 16 | +apiRouter.post('/sayHello', function(req, res) { |
| 18 | - "template": { | 17 | + const responseBody = { |
| 19 | - "outputs": [ | 18 | + version: "2.0", |
| 20 | - { | 19 | + template: { |
| 21 | - "basicCard": { | 20 | + outputs: [ |
| 22 | - "title": "보물상자", | ||
| 23 | - "description": "보물상자 안에는 뭐가 있을까", | ||
| 24 | - "thumbnail": { | ||
| 25 | - "imageUrl": "http://k.kakaocdn.net/dn/83BvP/bl20duRC1Q1/lj3JUcmrzC53YIjNDkqbWK/i_6piz1p.jpg" | ||
| 26 | - }, | ||
| 27 | - "profile": { | ||
| 28 | - "imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT4BJ9LU4Ikr_EvZLmijfcjzQKMRCJ2bO3A8SVKNuQ78zu2KOqM", | ||
| 29 | - "nickname": "보물상자" | ||
| 30 | - }, | ||
| 31 | - "social": { | ||
| 32 | - "like": 1238, | ||
| 33 | - "comment": 8, | ||
| 34 | - "share": 780 | ||
| 35 | - }, | ||
| 36 | - "buttons": [ | ||
| 37 | { | 21 | { |
| 38 | - "action": "message", | 22 | + simpleText: { |
| 39 | - "label": "열어보기", | 23 | + text: "hello I'm Ryan" |
| 40 | - "messageText": "짜잔! 우리가 찾던 보물입니다" | 24 | + } |
| 41 | - }, | ||
| 42 | - { | ||
| 43 | - "action": "webLink", | ||
| 44 | - "label": "구경하기", | ||
| 45 | - "webLinkUrl": "https://e.kakao.com/t/hello-ryan" | ||
| 46 | } | 25 | } |
| 47 | ] | 26 | ] |
| 48 | } | 27 | } |
| 28 | + }; | ||
| 29 | + | ||
| 30 | + res.status(200).send(responseBody); | ||
| 31 | +}); | ||
| 32 | + | ||
| 33 | +apiRouter.post('/showHello', function(req, res) { | ||
| 34 | + console.log(req.body); | ||
| 35 | + | ||
| 36 | + const responseBody = { | ||
| 37 | + version: "2.0", | ||
| 38 | + template: { | ||
| 39 | + outputs: [ | ||
| 40 | + { | ||
| 41 | + simpleImage: { | ||
| 42 | + imageUrl: "https://t1.daumcdn.net/friends/prod/category/M001_friends_ryan2.jpg", | ||
| 43 | + altText: "hello I'm Ryan" | ||
| 44 | + } | ||
| 49 | } | 45 | } |
| 50 | ] | 46 | ] |
| 51 | } | 47 | } |
| 52 | }; | 48 | }; |
| 53 | - */ | 49 | + |
| 50 | + res.status(200).send(responseBody); | ||
| 54 | }); | 51 | }); |
| 55 | /* | 52 | /* |
| 56 | const fs = require('fs'); | 53 | const fs = require('fs'); |
| ... | @@ -68,6 +65,7 @@ app.post('/champion',function(req,res){ | ... | @@ -68,6 +65,7 @@ app.post('/champion',function(req,res){ |
| 68 | }) | 65 | }) |
| 69 | 66 | ||
| 70 | 67 | ||
| 68 | + | ||
| 71 | app.get('/', function(req, res){ | 69 | app.get('/', function(req, res){ |
| 72 | res.send('Hello, World!'); | 70 | res.send('Hello, World!'); |
| 73 | }) | 71 | }) |
| ... | @@ -84,10 +82,7 @@ app.get('/users/:userId/books/:bookId', function(req, res){ | ... | @@ -84,10 +82,7 @@ app.get('/users/:userId/books/:bookId', function(req, res){ |
| 84 | console.log(req.params.bookId) | 82 | console.log(req.params.bookId) |
| 85 | res.send(req.params); | 83 | res.send(req.params); |
| 86 | }) | 84 | }) |
| 87 | - | ||
| 88 | -var server = app.listen(23023, function(){ | ||
| 89 | - var host = server.address().address | ||
| 90 | - var port = server.address().port | ||
| 91 | - console.log("Example app listening at https://tft-helper.tk", host, port) | ||
| 92 | -}) | ||
| 93 | */ | 85 | */ |
| 86 | +app.listen(3000, function(){ | ||
| 87 | + console.log("Example skill server listening on port 3000!"); | ||
| 88 | +}); | ... | ... |
data/package-lock.json
0 → 100644
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment