Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김시환
/
emergency_room_ChatBot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김시환
2022-11-28 10:51:47 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
b825bef88544d8abd63a8a9e2f415d4b2f2a4452
b825bef8
2 parents
a771dbc6
ca89e628
Merge branch 'sihwan'
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
app.js
app.js
View file @
b825bef
...
...
@@ -6,24 +6,21 @@ const TOKEN = 'YK56BfHFgpILrxRk1FZrdcouFguf5CBA5qxM3zfDH6N9jR/cfPxVdK1P9vZHAk69m
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
domain
=
"
ec2-18-215-162-16.compute-1.amazonaws.com
"
const
domain
=
"
2019102158.oss2022chatbot.tk
"
const
sslport
=
23023
;
const
bodyParser
=
require
(
'body-parser'
);
const
app
=
express
();
console
.
log
(
Address
.
getAddress
(
'석수동길'
));
app
.
use
(
bodyParser
.
json
());
app
.
post
(
'/hook'
,
function
(
req
,
res
)
{
var
eventObj
=
req
.
body
.
events
[
0
];
var
source
=
eventObj
.
source
;
var
message
=
eventObj
.
message
;
//
var source = eventObj.source;
//
var message = eventObj.message;
// request log
console
.
log
(
'======================'
,
new
Date
()
,
'======================'
);
console
.
log
(
'[request]'
,
req
.
body
);
console
.
log
(
'[request source] '
,
eventObj
.
source
);
console
.
log
(
'[request message]'
,
eventObj
.
message
);
console
.
log
((
Address
.
getAddress
(
'석수동길'
)).
road_address
.
address_name
)
request
.
post
(
{
url
:
TARGET_URL
,
...
...
@@ -31,17 +28,18 @@ app.post('/hook', function (req, res) {
'Authorization'
:
`Bearer
${
TOKEN
}
`
},
json
:
{
"replyToken"
:
eventObj
.
replyToken
,
"replyToken"
:
eventObj
.
replyToken
,
//eventObj.replyToken
"messages"
:[
{
"type"
:
"text"
,
"text"
:
"Hello, user"
"text"
:
address
},
{
"type"
:
"text"
,
"text"
:
"
May I help you
?"
"text"
:
"
맞나요
?"
}
]
],
"status"
:
1
}
},(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
...
...
@@ -49,6 +47,12 @@ app.post('/hook', function (req, res) {
res
.
sendStatus
(
200
);
});
try
{
const
option
=
{
ca
:
fs
.
readFileSync
(
'/etc/letsencrypt/live/'
+
domain
+
'/fullchain.pem'
),
...
...
Please
register
or
login
to post a comment