main Removed https dev server

This commit is contained in:
Nikolaj Frey 2023-05-03 09:15:43 +10:00
parent b552b485b8
commit e80c6b490b
3 changed files with 0 additions and 40 deletions

View File

@ -4,7 +4,6 @@
"private": true,
"scripts": {
"dev": "next dev",
"https": "node server.js",
"build": "next build",
"start": "next start",
"lint": "next lint"

View File

@ -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)

View File

@ -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',