const express = require('express');
const fs = require('fs');
const options = {
key: fs.readFileSync('./rootca.key'),
cert: fs.readFileSync('./rootca.crt')
};
const app = express();
// Default route for server status
app.get('/', (req, res) => { res.json({ message: `Server is running on port ${req.secure ? HTTPS_PORT : HTTP_PORT}` }); });
// Create an HTTP server.
http.createServer(app).listen(HTTP_PORT);
// Create an HTTPS server.
https.createServer(options, app).listen(HTTPS_PORT);
'기타 > WEB' 카테고리의 다른 글
[Next.js] Next.js 13 font 적용 (0) | 2023.06.10 |
---|---|
[JavaScript] 문자열을 숫자로 변환하기 (0) | 2023.06.05 |
MEDIA WIKI (0) | 2022.08.28 |
Cookies & Sessions (0) | 2022.08.28 |