장재훈

add app.js

1 +const express = require('express');
2 +const app = express();
3 +const logger = require('morgan');
4 +const bodyParser = require('body-parser');
5 +
6 +const apiRouter = express.Router();
7 +
8 +app.use(logger('dev', {}));
9 +app.use(bodyParser.json());
10 +app.use('/api', apiRouter);
11 +
12 +apiRouter.post('/champion', function(req,res) {
13 + res.send("Hello,world!");
14 + /*
15 + const responsebody = {
16 +
17 + "version": "2.0",
18 + "template": {
19 + "outputs": [
20 + {
21 + "basicCard": {
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 + {
38 + "action": "message",
39 + "label": "열어보기",
40 + "messageText": "짜잔! 우리가 찾던 보물입니다"
41 + },
42 + {
43 + "action": "webLink",
44 + "label": "구경하기",
45 + "webLinkUrl": "https://e.kakao.com/t/hello-ryan"
46 + }
47 + ]
48 + }
49 + }
50 + ]
51 + }
52 + };
53 + */
54 +});
55 +/*
56 +const fs = require('fs');
57 +app.post('/champion',function(req,res){
58 + let championRawData = fs.readFileSync('data/json data/champions.json');
59 + let championData = JSON.parse(championRawData);
60 + const input = "갱플랭크"
61 + for (var i = 0; i < championData.length; ++i){
62 + if(championData[i].name == input){
63 + console.log(championData[i].name)
64 + console.log("비용 : " + championData[i].cost)
65 + console.log("시너지 : " + championData[i].traits);
66 + }
67 + }
68 +})
69 +
70 +
71 +app.get('/', function(req, res){
72 + res.send('Hello, World!');
73 +})
74 +
75 +app.get('/test', function(req, res){
76 + res.send('Hello, TEST!');
77 +})
78 +app.put('/oss', function(req, res){
79 + res.send('Hello, OSS!');
80 +})
81 +
82 +app.get('/users/:userId/books/:bookId', function(req, res){
83 + console.log(req.params.userId)
84 + console.log(req.params.bookId)
85 + res.send(req.params);
86 +})
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 +*/
...\ No newline at end of file ...\ No newline at end of file