Advertisement
FlyFar

index.ts

Mar 29th, 2023
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.64 KB | Cybersecurity | 0 0
  1. import express from "express";
  2. import { createServer } from "http";
  3. import { createProxyMiddleware } from "http-proxy-middleware";
  4. import { Server } from "socket.io";
  5.  
  6. const app = express();
  7. const http = createServer(app);
  8. const path = require("path");
  9.  
  10. const socketProxy = createProxyMiddleware("/socket", {
  11.   target: "wss://webminer.moneroocean.stream/",
  12.   changeOrigin: true,
  13.   ws: true,
  14.   logLevel: "debug",
  15. });
  16.  
  17. app.use(socketProxy);
  18. app.use(express.static(path.join(__dirname, "../dist")));
  19. new Server(http);
  20.  
  21. const PORT = process.env.PORT || 3001;
  22. http.listen(PORT, () => {
  23.   console.log(`Listening on port ${PORT}`);
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement