main Removed https dev server
This commit is contained in:
parent
b552b485b8
commit
e80c6b490b
@ -4,7 +4,6 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"https": "node server.js",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
|
@ -1,34 +0,0 @@
|
||||
const https = require('https');
|
||||
const httpProxy = require('http-proxy');
|
||||
const ws = require('ws');
|
||||
const fs = require('fs');
|
||||
const port = 3001
|
||||
|
||||
console.log('running')
|
||||
|
||||
const options = {
|
||||
key: fs.readFileSync('localhost-key.pem'),
|
||||
cert: fs.readFileSync('localhost.pem')
|
||||
};
|
||||
|
||||
const proxy = httpProxy.createProxyServer({
|
||||
target: 'http://0.0.0.0:3000'
|
||||
});
|
||||
|
||||
const server = https.createServer(options, (req, res) => {
|
||||
proxy.web(req, res);
|
||||
});
|
||||
|
||||
const wssProxy = new ws.Server({ noServer: true });
|
||||
server.on('upgrade', (req, socket, head) => {
|
||||
console.log(req.url)
|
||||
if (req.url.startsWith('/_next/webpack-hmr')) {
|
||||
wssProxy.handleUpgrade(req, socket, head, (ws) => {
|
||||
proxy.ws(req, ws, head);
|
||||
});
|
||||
} else {
|
||||
socket.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(port)
|
@ -5,11 +5,6 @@ module.exports = {
|
||||
name: "thingtime-app",
|
||||
namespace: "thingtime"
|
||||
},
|
||||
{
|
||||
script: 'npm run app-https',
|
||||
name: "thingtime-app-https",
|
||||
namespace: "thingtime"
|
||||
},
|
||||
{
|
||||
script: 'npm run api',
|
||||
name: 'thingtime-api',
|
||||
|
Loading…
Reference in New Issue
Block a user