Skip to content

Commit

Permalink
start terminal server from indexjs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelja committed Jan 29, 2018
1 parent e56b4a5 commit 42e031f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ function addGitPath() {
function startElectron() {
addGitPath();
setTimeout(startServer, 0);
var terminalServer = require('./server.js');
terminalServer.terminalServer(5000);
setTimeout(createWebWindow, 1000);
}

Expand Down
20 changes: 16 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
}
};

0 comments on commit 42e031f

Please sign in to comment.