Showing
4 changed files
with
10 additions
and
11 deletions
.package.swp
0 → 100644
No preview for this file type
This diff is collapsed. Click to expand it.
... | @@ -6,9 +6,10 @@ const app = express(); | ... | @@ -6,9 +6,10 @@ const app = express(); |
6 | const PAPAGO_URL = 'https://openapi.naver.com/v1/papago/n2mt' | 6 | const PAPAGO_URL = 'https://openapi.naver.com/v1/papago/n2mt' |
7 | const PAPAGO_ID = 'cIZBOTfISMHEyygh_NHp'; | 7 | const PAPAGO_ID = 'cIZBOTfISMHEyygh_NHp'; |
8 | const PAPAGO_SECRET = '8D32UNGgYp'; | 8 | const PAPAGO_SECRET = '8D32UNGgYp'; |
9 | +const path = require('path'); | ||
9 | const HTTPS = require('https'); | 10 | const HTTPS = require('https'); |
10 | const domain = "www.chatosscjh.tk" | 11 | const domain = "www.chatosscjh.tk" |
11 | -const PORT = process.env.PORT || 3000; | 12 | +const sslport = 23023; |
12 | 13 | ||
13 | //const indexRoute = require("./routes/index"); | 14 | //const indexRoute = require("./routes/index"); |
14 | app.use(bodyParser.urlencoded({extended: true})); | 15 | app.use(bodyParser.urlencoded({extended: true})); |
... | @@ -82,6 +83,7 @@ app.post('/', async function(req,res){ | ... | @@ -82,6 +83,7 @@ app.post('/', async function(req,res){ |
82 | extraaddressE = body.message.result.translatedText; | 83 | extraaddressE = body.message.result.translatedText; |
83 | } | 84 | } |
84 | }); | 85 | }); |
86 | + | ||
85 | setTimeout(function(){ | 87 | setTimeout(function(){ |
86 | var splitaddressE = addressE.split(", "); | 88 | var splitaddressE = addressE.split(", "); |
87 | cityE = splitaddressE[4]; | 89 | cityE = splitaddressE[4]; |
... | @@ -100,11 +102,6 @@ app.post('/', async function(req,res){ | ... | @@ -100,11 +102,6 @@ app.post('/', async function(req,res){ |
100 | } | 102 | } |
101 | }); | 103 | }); |
102 | 104 | ||
103 | - | ||
104 | -app.listen(PORT, function(){ | ||
105 | - console.log('listen',PORT); | ||
106 | -}); | ||
107 | - | ||
108 | function trans(message, totrans){ | 105 | function trans(message, totrans){ |
109 | request.post( | 106 | request.post( |
110 | { | 107 | { |
... | @@ -129,14 +126,14 @@ function trans(message, totrans){ | ... | @@ -129,14 +126,14 @@ function trans(message, totrans){ |
129 | try { | 126 | try { |
130 | const option = { | 127 | const option = { |
131 | ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'), | 128 | ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'), |
132 | - key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/'$ | 129 | + key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(), |
133 | - cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/$ | 130 | + cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(), |
134 | }; | 131 | }; |
135 | - | 132 | + |
136 | HTTPS.createServer(option, app).listen(sslport, () => { | 133 | HTTPS.createServer(option, app).listen(sslport, () => { |
137 | console.log(`[HTTPS] Server is started on port ${sslport}`); | 134 | console.log(`[HTTPS] Server is started on port ${sslport}`); |
138 | }); | 135 | }); |
139 | } catch (error) { | 136 | } catch (error) { |
140 | - console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않 $ | 137 | + console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'); |
141 | console.log(error); | 138 | console.log(error); |
142 | } | 139 | } | ... | ... |
-
Please register or login to post a comment