장재훈

modify app.js

......@@ -7,50 +7,47 @@ const apiRouter = express.Router();
app.use(logger('dev', {}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.use('/api', apiRouter);
apiRouter.post('/champion', function(req,res) {
res.send("Hello,world!");
/*
const responsebody = {
"version": "2.0",
"template": {
"outputs": [
{
"basicCard": {
"title": "보물상자",
"description": "보물상자 안에는 뭐가 있을까",
"thumbnail": {
"imageUrl": "http://k.kakaocdn.net/dn/83BvP/bl20duRC1Q1/lj3JUcmrzC53YIjNDkqbWK/i_6piz1p.jpg"
},
"profile": {
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT4BJ9LU4Ikr_EvZLmijfcjzQKMRCJ2bO3A8SVKNuQ78zu2KOqM",
"nickname": "보물상자"
},
"social": {
"like": 1238,
"comment": 8,
"share": 780
},
"buttons": [
{
"action": "message",
"label": "열어보기",
"messageText": "짜잔! 우리가 찾던 보물입니다"
},
{
"action": "webLink",
"label": "구경하기",
"webLinkUrl": "https://e.kakao.com/t/hello-ryan"
}
]
}
}
]
}
};
*/
apiRouter.post('/sayHello', function(req, res) {
const responseBody = {
version: "2.0",
template: {
outputs: [
{
simpleText: {
text: "hello I'm Ryan"
}
}
]
}
};
res.status(200).send(responseBody);
});
apiRouter.post('/showHello', function(req, res) {
console.log(req.body);
const responseBody = {
version: "2.0",
template: {
outputs: [
{
simpleImage: {
imageUrl: "https://t1.daumcdn.net/friends/prod/category/M001_friends_ryan2.jpg",
altText: "hello I'm Ryan"
}
}
]
}
};
res.status(200).send(responseBody);
});
/*
const fs = require('fs');
......@@ -68,6 +65,7 @@ app.post('/champion',function(req,res){
})
app.get('/', function(req, res){
res.send('Hello, World!');
})
......@@ -84,10 +82,7 @@ app.get('/users/:userId/books/:bookId', function(req, res){
console.log(req.params.bookId)
res.send(req.params);
})
var server = app.listen(23023, function(){
var host = server.address().address
var port = server.address().port
console.log("Example app listening at https://tft-helper.tk", host, port)
})
*/
\ No newline at end of file
*/
app.listen(3000, function(){
console.log("Example skill server listening on port 3000!");
});
......
This diff is collapsed. Click to expand it.