Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Chat_Bot
/
KaKao_ChatBot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
윤준현
2018-11-25 01:05:55 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b996e7ceb0318c38133739a5ea7863ac424ca5af
b996e7ce
1 parent
f499ba8e
test1
use localhost
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
app.js
app.js
View file @
b996e7c
...
...
@@ -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
'
r
eol'
:
case
'
R
eol'
:
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
...
...
Please
register
or
login
to post a comment