forked from market21st/21market-v3-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
27 lines (25 loc) · 824 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* server.js 파일입니다 */
const { createServer } = require("https");
const { parse } = require("url");
const next = require("next");
const fs = require("fs");
const port = 3000;
const dev = process.env.NODE_ENV !== "production";
const app = next({ dev });
const handle = app.getRequestHandler();
/* 이부분에 3번 에서 만든 인증서 정보를 입력해야 합니다 */
const httpsOptions = {
key: fs.readFileSync("./test.hambabwa.kr-key.pem"),
cert: fs.readFileSync("./test.hambabwa.kr.pem"),
};
app.prepare().then(() => {
createServer(httpsOptions, (req, res) => {
const parsedUrl = parse(req.url, true);
handle(req, res, parsedUrl);
}).listen(port, (err) => {
if (err) throw err;
console.log(
"ready - started server on url: https://test.hambabwa.kr:" + port
);
});
});