Toggle navigation
Toggle navigation
This project
Loading...
Sign in
전언석
/
Ingredient-to-Dish-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
2022-05-31 08:22:17 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
43c699de60218cfbf49e1467117e3c9b83412e8a
43c699de
1 parent
4403739d
test start
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
Experiments/messenger/webhook/test.js
Experiments/messenger/webhook/test.js
0 → 100644
View file @
43c699d
var
express
=
require
(
'express'
);
const
bodyParser
=
require
(
'body-parser'
);
var
app
=
express
();
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
domain
=
"2019102226.osschatbot2022.ml"
const
sslport
=
23023
;
app
.
use
(
bodyParser
.
json
());
app
.
post
(
'/hook'
,
function
(
request
,
response
)
{
var
eventObj
=
request
.
body
.
events
[
0
];
// request log
console
.
log
(
'======================'
,
new
Date
(),
'======================'
);
response
.
sendStatus
(
200
);
});
try
{
const
option
=
{
ca
:
fs
.
readFileSync
(
'/etc/letsencrypt/live/'
+
domain
+
'/fullchain.pem'
),
key
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
domain
+
'/privkey.pem'
),
'utf8'
).
toString
(),
cert
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
domain
+
'/cert.pem'
),
'utf8'
).
toString
(),
};
HTTPS
.
createServer
(
option
,
app
).
listen
(
sslport
,
()
=>
{
console
.
log
(
`[HTTPS] Server is started on port
${
sslport
}
`
);
});
}
catch
(
error
)
{
console
.
log
(
'[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'
);
console
.
log
(
error
);
}
Please
register
or
login
to post a comment