Toggle navigation
Toggle navigation
This project
Loading...
Sign in
고혜연
/
DessertChatbot
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
윤성아
2021-06-10 10:06:14 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
023fd74334cd7502e6c7fead811ba4ec0675e4e2
023fd743
1 parent
2e6dc295
apply https
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
4 deletions
https/app.js
https/constants.js
https/index.js
package.json
https/app.js
0 → 100644
View file @
023fd74
const
express
=
require
(
'express'
);
const
app
=
express
();
app
.
get
(
'/'
,
(
req
,
res
)
=>
{
res
.
send
(
'Hello world!'
);
});
module
.
exports
=
app
;
\ No newline at end of file
https/constants.js
0 → 100644
View file @
023fd74
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
domain
=
'2020105640.oss-2021.tk'
;
module
.
exports
=
{
LINE
:
{
URL
:
{
NOTIFY
:
'https://notify-api.line.me/api/notify'
,
},
TOKEN
:
'Cu3yosmWtXOPBhjccMCdJj2YH1g5KF8rhBv0zHZyqj3uYOrHSPYkixI+6SP7bfZOdC8J4xwhOriJahHtLxsQxUMnTaanncGyAyTFyD9+18gvzEcS39plUIadREyL38HoY/9o6O3a3guSOMxyiT+cJQdB04t89/1O/w1cDnyilFU='
,
},
CONFIG
:
{
PORT
:
443
,
HTTPS_OPTIONS
:
{
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
(),
}
}
};
\ No newline at end of file
https/index.js
0 → 100644
View file @
023fd74
const
https
=
require
(
'https'
);
const
app
=
require
(
'./app'
);
const
constants
=
require
(
'./constants'
);
try
{
const
options
=
constants
.
CONFIG
.
HTTPS_OPTIONS
;
https
.
createServer
(
options
,
app
).
listen
(
constants
.
CONFIG
.
PORT
,
()
=>
{
console
.
log
(
`[SYSTEM] HTTPS server is running on port
${
constants
.
CONFIG
.
PORT
}
`
);
})
}
catch
(
err
)
{
console
.
log
(
'[SYSTEM] Cannot start HTTPS server.'
);
console
.
log
(
err
);
}
\ No newline at end of file
package.json
View file @
023fd74
...
...
@@ -2,11 +2,11 @@
"name"
:
"sweetday-dessert-chatbot"
,
"version"
:
"1.0.0"
,
"description"
:
"Chatbot based on Express.js, Line API"
,
"main"
:
"
app
.js"
,
"main"
:
"
index
.js"
,
"scripts"
:
{
"start"
:
"node
app
.js"
,
"start:dev"
:
"nodemon
app
.js"
,
"start:prod"
:
"pm2
app
.js"
,
"start"
:
"node
https/index
.js"
,
"start:dev"
:
"nodemon
--watch https/ https/index
.js"
,
"start:prod"
:
"pm2
https/index
.js"
,
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"repository"
:
{
...
...
@@ -23,5 +23,8 @@
"license"
:
"MIT"
,
"dependencies"
:
{
"express"
:
"^4.17.1"
},
"devDependencies"
:{
"nodemon"
:
"^2.0.7"
}
}
...
...
Please
register
or
login
to post a comment