Showing
5 changed files
with
25 additions
and
19 deletions
| 1 | const express = require('express'); | 1 | const express = require('express'); |
| 2 | const path = require('path'); | 2 | const path = require('path'); |
| 3 | const app = express(); | 3 | const app = express(); |
| 4 | -var url = require('url'); | 4 | +const HTTPS = require('https'); |
| 5 | +const url = require('url'); | ||
| 5 | require('dotenv').config(); | 6 | require('dotenv').config(); |
| 6 | 7 | ||
| 7 | //화면 별 router 연결, 라우터 호출해서 페이지를 불러오는데 사용함. | 8 | //화면 별 router 연결, 라우터 호출해서 페이지를 불러오는데 사용함. |
| 8 | -var mainRouter = require('./routes') //호출시 index.js 실행 (main.js : title 할당하고 main.html 열어줌) | 9 | +const mainRouter = require('./routes') //호출시 index.js 실행 (main.js : title 할당하고 main.html 열어줌) |
| 9 | - | 10 | +const domain = "www.culturegallery.ml" |
| 11 | +const sslport = 23023; | ||
| 10 | //디폴트 포트 값 : 8000 | 12 | //디폴트 포트 값 : 8000 |
| 11 | app.set('port', process.env.PORT || 23023); | 13 | app.set('port', process.env.PORT || 23023); |
| 12 | 14 | ||
| ... | @@ -28,11 +30,17 @@ app.get("/find", function (req, res) { | ... | @@ -28,11 +30,17 @@ app.get("/find", function (req, res) { |
| 28 | res.send(querystring.word); | 30 | res.send(querystring.word); |
| 29 | }); | 31 | }); |
| 30 | 32 | ||
| 31 | -app.get('/logout', function (req, res) { | 33 | +try { |
| 32 | - res.send("Logout success"); | 34 | + const option = { |
| 33 | -}); | 35 | + ca: fs.readFileSync('/etc/letsencrypt/live/' + domain + '/fullchain.pem'), |
| 34 | - | 36 | + key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/privkey.pem'), 'utf8').toString(), |
| 35 | - | 37 | + cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/cert.pem'), 'utf8').toString(), |
| 36 | -app.listen(app.get('port'), () => { | 38 | + }; |
| 37 | - console.log(`Server is running at ${app.get('port')}`); | 39 | + |
| 38 | -}); | 40 | + HTTPS.createServer(option, app).listen(sslport, () => { |
| 41 | + console.log(`Server is running at ${app.get('port')}`); | ||
| 42 | + }); | ||
| 43 | +} catch (error) { | ||
| 44 | + console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'); | ||
| 45 | + console.warn(error); | ||
| 46 | +} | ... | ... |
This diff is collapsed. Click to expand it.
| 1 | var mysql = require('mysql'); | 1 | var mysql = require('mysql'); |
| 2 | 2 | ||
| 3 | var database = mysql.createConnection({ | 3 | var database = mysql.createConnection({ |
| 4 | - host: process.env.HOST, | 4 | + host: "culturegallery.cm2bwcuyukrm.us-east-1.rds.amazonaws.com", |
| 5 | - user: process.env.USER, | 5 | + user: "root", |
| 6 | - password: process.env.PASSWORD, | 6 | + password: "dldbwp1207", |
| 7 | port: 3306, | 7 | port: 3306, |
| 8 | database: "showdata" | 8 | database: "showdata" |
| 9 | }); | 9 | }); | ... | ... |
| ... | @@ -3,10 +3,7 @@ | ... | @@ -3,10 +3,7 @@ |
| 3 | 3 | ||
| 4 | <head> | 4 | <head> |
| 5 | <title> | 5 | <title> |
| 6 | - <%= title%> | 6 | + <script>title</script> |
| 7 | - <script> | ||
| 8 | - | ||
| 9 | - </script> | ||
| 10 | </title> | 7 | </title> |
| 11 | <link rel="stylesheet" href='/stylesheets/mapPage_style.css' type="text/css"> | 8 | <link rel="stylesheet" href='/stylesheets/mapPage_style.css' type="text/css"> |
| 12 | <link rel="shortcut icon" href="/images/favicon.ico"> | 9 | <link rel="shortcut icon" href="/images/favicon.ico"> | ... | ... |
-
Please register or login to post a comment