Skip to content

Instantly share code, notes, and snippets.

@irisjae
Created June 19, 2019 03:59
Show Gist options
  • Save irisjae/3869a6b9b21d6b01f1b30f20b2519a9e to your computer and use it in GitHub Desktop.
Save irisjae/3869a6b9b21d6b01f1b30f20b2519a9e to your computer and use it in GitHub Desktop.
deploy servers
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