Toggle navigation
Toggle navigation
This project
Loading...
Sign in
정윤지
/
Word_Chain_Chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
EC2 Default User
2021-12-03 08:46:21 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6e5aa00d64b334901ba8e648f76ebe304d13f2a7
6e5aa00d
1 parent
e37dbc6c
Configure webhook
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
app.js
app.js
View file @
6e5aa00
...
...
@@ -2,16 +2,30 @@ const express = require('express');
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
app
=
express
();
const
domain
=
"2020105659.osschatbot.cf"
const
sslport
=
23023
;
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'Hello World'
);
})
//Configure webhook
const
bodyParser
=
require
(
'body-parser'
);
const
app
=
express
();
app
.
use
(
bodyParser
.
json
());
app
.
post
(
'/hook'
,
function
(
request
,
response
)
{
var
eventObj
=
request
.
body
.
events
[
0
];
var
source
=
eventObj
.
source
;
var
message
=
eventObj
.
message
;
// request log
console
.
log
(
'======================'
,
new
Date
()
,
'======================'
);
console
.
log
(
'[request]'
,
request
.
body
);
console
.
log
(
'[request source] '
,
eventObj
.
source
);
console
.
log
(
'[request message]'
,
eventObj
.
message
);
response
.
sendStatus
(
200
);
});
//Set SSL
try
{
const
option
=
{
ca
:
fs
.
readFileSync
(
'/etc/letsencrypt/live/'
+
domain
+
'/fullchain.pem'
),
...
...
Please
register
or
login
to post a comment