Last active
February 21, 2021 13:43
-
-
Save doyle-flutter/06563ce49377c86b013f98923249f1fc to your computer and use it in GitHub Desktop.
webRTC 서버연결
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // * Node.js 개발 테스트용 HTTPS pem 생성 | |
| // : 해당 서버 파일의 위치에 keys 폴더를 생성하고 아래의 내용으로 생성한 pem을 담아주세요. | |
| // > openssl genrsa 1024 > private.pem | |
| // > openssl req -x509 -new -key private.pem > public.pem | |
| // * npm i -s expreess https path | |
| var express = require('express'), | |
| app = express(), | |
| fs = require('fs'), | |
| path = require('path'), | |
| https = require('https'), | |
| key = fs.readFileSync(path.join(__dirname,'./keys/private.pem')), // OpenSSL | |
| cert = fs.readFileSync(path.join(__dirname, './keys/public.pem')), // OpenSSL | |
| server = https.createServer({ key, cert, requestCert: false, rejectUnauthorized: false, },app); | |
| app.get('/', (req, res) => res.redirect(`/123`)); | |
| app.get('/:room', (req, res) => res.sendFile(path.join(__dirname, './views/room.html'))); | |
| server.listen(443); | |
| app.listen(3001); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment