윤준현

test1

use localhost
Showing 1 changed file with 20 additions and 15 deletions
......@@ -2,29 +2,26 @@
// 모듈 불러오기
var express = require('express');
var http = require('http');
var bodyParser = require('body-parser')
var bodyParser = require('body-parser');
var hostname = '210.89.181.183';
var port = 9090;
var app = express(); // express 객체 저장
app.set('port', process.env.PORT || 9090);
app.set('host', process.env.HOST || '210.89.181.183')
//body-parser 미들웨어 사용
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
// http://서버주소/keyboard
app.get('/keyboard', function(req,res){
var data = {'type' : 'buttons', 'buttons' : ['일본', '한국', '미국계'] };
var data = {
'type' : 'buttons',
'buttons' : ['일본', '한국', '미국계']};
res.json(data);
}
);
});
//9090포트로 서버 접속
http.createServer(app).listen(app.get('port'), app.get('host'), () => {
console.log('Server running at https://${hostname}:%{port}/');
http.createServer(app).listen(8080, () => {
console.log('Server running..');
});
......@@ -37,7 +34,7 @@ app.post('/message', function(req,res){
var send = {};
switch(msg){
case 'reol' :
case 'Reol' :
send = {
'message' : {
'text' : 'Reol',
......@@ -55,8 +52,17 @@ app.post('/message', function(req,res){
};
break;
case '가수' :
send = {};
case '일본' :
send = {
'message' : {
'text' : '등록된 가수 목록입니다.'
},
keyboard : {
'type' : 'buttons',
'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ']
}
};
break;
case 'C' :
send = {};
......@@ -65,6 +71,5 @@ app.post('/message', function(req,res){
send = {} ;
break;
}
res.json(send);
})
\ No newline at end of file
......