I have the following file:
index.js
const http = require('http');
const httpProxy = require('http-proxy');
const express = require('express');
const app = express();
const proxy = httpProxy.createProxyServer({
target: 'https://discord.com',
changeOrigin: true,
});
app.use('/', (req, res) => {
proxy.web(req, res);
});
const server = http.createServer(app);
const PORT = 8080;
server.listen(PORT, () => {
console.log(`Process ${process.pid} has been successfully run! On Port ${PORT}`);
});
This lets me access the discord homepage (just a filler website) but my one problem is that I want to make this part of a static website Im making on github pages but this is node.js. So how can I make it so I get the same output when running an html file that has the js file in a script tag as I would if I ran the js file with Node.JS?
I found vite that would have transferred a node.js file to a static file but when I try this tool on the following html file:
<html>
<head></head>
<body><script src="index.js" type="module"></script></body>
<html>
All I get is a blank web page.