Skip to content

Instantly share code, notes, and snippets.

@hoangsetup
Created May 30, 2021 08:13
Show Gist options
  • Save hoangsetup/394af8128d3ad354740b4daa5f20cfc3 to your computer and use it in GitHub Desktop.
Save hoangsetup/394af8128d3ad354740b4daa5f20cfc3 to your computer and use it in GitHub Desktop.
diff --git a/src/app.ts b/src/app.ts
index 60fe0f7..3d64562 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -1,5 +1,6 @@
import express from 'express';
import pm2Lib from './pm2Lib';
+import socketIO from './socketIO';
const app = express();
@@ -38,6 +39,8 @@ app.put('/miners/:filename/:action(start|restart|stop)', async (req, res) => {
const PORT = process.env.PORT || 3000;
-app.listen(PORT, () => {
+const httpServer = app.listen(PORT, () => {
console.log(`[Server] Listening on :${PORT}`);
});
+
+socketIO.init(httpServer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment