From 42e031f5d1a6c1fc2cb0d1464d97d97b5a4389ac Mon Sep 17 00:00:00 2001 From: Marcel Jankrift Date: Mon, 29 Jan 2018 13:16:02 +0100 Subject: [PATCH] start terminal server from indexjs --- index.js | 2 ++ server.js | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 8f55aa1..1486b06 100644 --- a/index.js +++ b/index.js @@ -40,6 +40,8 @@ function addGitPath() { function startElectron() { addGitPath(); setTimeout(startServer, 0); + var terminalServer = require('./server.js'); + terminalServer.terminalServer(5000); setTimeout(createWebWindow, 1000); } diff --git a/server.js b/server.js index b2ff860..bba362b 100644 --- a/server.js +++ b/server.js @@ -18,6 +18,10 @@ app.all('/*', function(req, res, next) { next(); }); +app.get("/terminalserver", function(req, res) { + res.send("running terminalserver"); +}); + app.get("/kill/*", function(req, res) { let id = req.params[0]; console.log(runningProcesses); @@ -69,7 +73,15 @@ app.get("/new/*", function(req, res){ res.send(id); }); -var port = process.env.PORT || 5000; -app.listen(port, function() { - console.log("Listening on " + port); -}); +// var port = process.env.PORT || 5000; +// app.listen(port, function() { +// console.log("Listening on " + port); +// }); + +module.exports = { + terminalServer: function (port) { + app.listen(port, function() { + console.log("Listening on " + port); + }); + } +};