Created
June 19, 2019 03:59
-
-
Save irisjae/3869a6b9b21d6b01f1b30f20b2519a9e to your computer and use it in GitHub Desktop.
deploy servers
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
var fs = require ('fs-extra') | |
var ws = require ('ws') | |
var http = require("http"); | |
var http_proxy = require('http-proxy'); | |
//var https = require('https'); | |
var app = require ('./server') | |
app .listen (8888) | |
;http .createServer ((req, res) => {; | |
;res .writeHead (301, { "Location": "https://" + req .headers ['host'] + req .url }) | |
;res .end () }) .listen (8080) | |
/*;(new ws .Server ({ server : https .createServer ({ | |
key: fs .readFileSync ('./privkey.pem') .toString (), | |
cert: fs .readFileSync ('./fullchain.pem') .toString () | |
}, app .callback ()) .listen (8443) }))*/ | |
;http_proxy .createServer ({ | |
target: { | |
host: 'localhost', | |
port: 8888 }, | |
ssl: { | |
key: fs .readFileSync ('./privkey.pem', 'utf8'), | |
cert: fs .readFileSync ('./fullchain.pem', 'utf8') }, | |
ws: true }) .listen (8443) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment