I have an Electron app that uses an Angular frontend served at port 4201 and a NodeJS backend. I want to make the app work multi-instance, which would require changing ports (I'm not sure yet whether to do this randomly or some other way). While it's easy to change the frontend from one port to another, the NodeJS backend remains at port 3000 no matter what I do. What, if anything can I do to move it? In Main.js I've tried
...
var routes = require('./backend_routes/query'); //importing route
routes(backend); //register the route
backend.listen(3001);
var win, serve;
var args = process.argv.slice(1);
serve = args.some(function (val) { return val === '--serve'; });
...
and the backend just keeps listening at port 3000.
EDIT:
There was a question about the code in backend_routes/query . This is that code:
//all the backend routes are specified here
'use strict';
module.exports = function(app) {
var query = require('../backend_controllers/query');
var reports = require('../backend_controllers/reports');
//Routes
app.route('/query').get(query.execute);
app.route('/databaselist').get(query.databaselist);
app.route('/redodatabaseconnection').get(query.redodatabaseconnection);
app.route('/lookupcollections').get(query.lookupcollections);
app.route('/lookupcollection').get(query.lookupcollection);
app.route('/showhistory').get(query.showhistory);
...
}
backend_routes/query
?