윤준현

test2

use localhost and function
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 var express = require('express'); 3 var express = require('express');
4 var http = require('http'); 4 var http = require('http');
5 var bodyParser = require('body-parser'); 5 var bodyParser = require('body-parser');
6 - 6 +var singer = require('./content')
7 var app = express(); // express 객체 저장 7 var app = express(); // express 객체 저장
8 8
9 //body-parser 미들웨어 사용 9 //body-parser 미들웨어 사용
...@@ -14,7 +14,7 @@ app.use(bodyParser.json()); ...@@ -14,7 +14,7 @@ app.use(bodyParser.json());
14 app.get('/keyboard', function(req,res){ 14 app.get('/keyboard', function(req,res){
15 var data = { 15 var data = {
16 'type' : 'buttons', 16 'type' : 'buttons',
17 - 'buttons' : ['일본', '한국', '미국계']}; 17 + 'buttons' : ['일본', '한국']};
18 res.json(data); 18 res.json(data);
19 19
20 }); 20 });
...@@ -34,42 +34,35 @@ app.post('/message', function(req,res){ ...@@ -34,42 +34,35 @@ app.post('/message', function(req,res){
34 var send = {}; 34 var send = {};
35 35
36 switch(msg){ 36 switch(msg){
37 - case 'Reol' : 37 + case '일본' :
38 send = { 38 send = {
39 'message' : { 39 'message' : {
40 - 'text' : 'Reol', 40 + 'text' : '등록된 가수 목록입니다.'
41 - 'photo' : {
42 - 'url' : 'https://www.reol.jp/images/profile/reol_Aphoto_2.png',
43 - 'width' : 1000,
44 - 'height' : 667
45 }, 41 },
46 - 'message_button' : { 42 + keyboard : {
47 - 'label' : '공식 홈페이지', 43 + 'type' : 'buttons',
48 - 'url' : "https://www.reol.jp/" 44 + 'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ', 'Polkadot Stingray', 'Aimyong']
49 - }
50 } 45 }
51 46
52 -
53 }; 47 };
54 break; 48 break;
55 - case '일본' : 49 + case '한국' :
56 send = { 50 send = {
57 'message' : { 51 'message' : {
58 'text' : '등록된 가수 목록입니다.' 52 'text' : '등록된 가수 목록입니다.'
59 }, 53 },
60 keyboard : { 54 keyboard : {
61 'type' : 'buttons', 55 'type' : 'buttons',
62 - 'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ'] 56 + 'buttons' : ['볼빨간 사춘기', 'MOT', 'Gukkasten', 'ZICO', 'DEAN', 'IU', 'Heize']
63 } 57 }
64 -
65 }; 58 };
66 break; 59 break;
67 - case 'C' :
68 - send = {};
69 - break;
70 default: 60 default:
71 - send = {} ; 61 + send = singer.jpSinger(msg);
62 + if(send == '')
63 + send = singer.krSinger(msg);
72 break; 64 break;
73 } 65 }
66 + console.log(send);
74 res.json(send); 67 res.json(send);
75 }) 68 })
...\ No newline at end of file ...\ No newline at end of file
......
1 +function jpSinger(msg){
2 + var send = {};
3 + switch(msg){
4 + case 'Reol' :
5 + send = {
6 + 'message' : {
7 + 'text' : '이름 : Reol(れをる) \n성별 : 여성 \n생년월일 : 1993년 11월 9일 \n혈액형 : AB형',
8 + 'photo' : {
9 + 'url' : 'https://www.reol.jp/images/profile/reol_Aphoto_2.png',
10 + 'width' : 1000,
11 + 'height' : 667
12 + },
13 + 'message_button' : {
14 + 'label' : '공식 홈페이지',
15 + 'url' : "https://www.reol.jp/"
16 + }
17 + },
18 + keyboard : {
19 + 'type' : 'buttons',
20 + 'buttons' : ['Reol-Discography']
21 + }
22 + };
23 + break;
24 + case 'Reol-Discography' :
25 + send = {
26 + 'message' : {
27 + 'text' : 'Album List'
28 + },
29 + keyboard : {
30 + 'type' : 'buttons',
31 + 'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ', 'Polkadot Stingray', 'Aimyong']
32 + }
33 +
34 + };
35 + break;
36 + case '米津玄師' :
37 + send = {
38 + 'message' : {
39 + 'text' : '이름 : 米津玄師(Yonezu Kenshi) \n 성별 : 남성 \n생년월일 : 1991년 3월 10일 \n혈액형 : O형',
40 + 'photo' : {
41 + 'url' : 'http://reissuerecords.net/rr/wp-content/uploads/flamingo_photo2.jpg',
42 + 'width' : 1000,
43 + 'height' : 667
44 + },
45 + 'message_button' : {
46 + 'label' : '공식 홈페이지',
47 + 'url' : "http://reissuerecords.net/"
48 + }
49 + },
50 + keyboard : {
51 + 'type' : 'buttons',
52 + 'buttons' : ['米津玄師-Discography']
53 + }
54 + };
55 + break;
56 + case '米津玄師-Discography' :
57 + send = {
58 + 'message' : {
59 + 'text' : 'Album List'
60 + },
61 + keyboard : {
62 + 'type' : 'buttons',
63 + 'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ', 'Polkadot Stingray', 'Aimyong']
64 + }
65 +
66 + };
67 + break;
68 +
69 + default:
70 + break;
71 + }
72 +
73 + return send;
74 +}
75 +
76 +function krSinger(msg){
77 + var send = {};
78 + switch(msg){
79 + case '볼빨간사춘기' :
80 + send = {
81 + 'message' : {
82 + 'text' : 'Reol',
83 + 'photo' : {
84 + 'url' : 'https://www.reol.jp/images/profile/reol_Aphoto_2.png',
85 + 'width' : 1000,
86 + 'height' : 667
87 + },
88 + 'message_button' : {
89 + 'label' : '공식 홈페이지',
90 + 'url' : "https://www.reol.jp/"
91 + },
92 + },
93 + keyboard : {
94 + 'type' : 'buttons',
95 + 'buttons' : ['Reol-Discography', 'Reol-Profile']
96 + }
97 + };
98 + break;
99 + case 'Reol-Discography' :
100 + send = {
101 + 'message' : {
102 + 'text' : 'Album List.'
103 + },
104 + keyboard : {
105 + 'type' : 'buttons',
106 + 'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ', 'Polkadot Stingray', 'Aimyong']
107 + }
108 +
109 + };
110 + break;
111 + case '米津玄師' :
112 + send = {
113 + 'message' : {
114 + 'text' : '米津玄師',
115 + 'photo' : {
116 + 'url' : 'https://www.reol.jp/images/profile/reol_Aphoto_2.png',
117 + 'width' : 1000,
118 + 'height' : 667
119 + },
120 + 'message_button' : {
121 + 'label' : '공식 홈페이지',
122 + 'url' : "https://www.reol.jp/"
123 + }
124 + },
125 + keyboard : {
126 + 'type' : 'buttons',
127 + 'buttons' : ['Reol-Discography','Reol-Profile']
128 + }
129 + };
130 + break;
131 + default:
132 + send = {
133 + 'message' : {
134 + 'text' : '등록되지 않은 가수입니다.'
135 + },
136 + keyboard : {
137 + 'type' : 'buttons',
138 + 'buttons' : ['한국', '일본']
139 + }
140 + }
141 + break;
142 + }
143 +
144 + return send;
145 +}
146 +
147 +exports.jpSinger = jpSinger;
148 +exports.krSinger = krSinger;
...\ No newline at end of file ...\ No newline at end of file