mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
close server
This commit is contained in:
@@ -48,6 +48,7 @@ process.on("uncaughtException", function (err) {
|
|||||||
*/
|
*/
|
||||||
function App() {
|
function App() {
|
||||||
let nodeHelpers = [];
|
let nodeHelpers = [];
|
||||||
|
let httpServer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the config file. Combines it with the defaults, and runs the
|
* Loads the config file. Combines it with the defaults, and runs the
|
||||||
@@ -222,7 +223,7 @@ function App() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadModules(modules, function () {
|
loadModules(modules, function () {
|
||||||
const server = new Server(config, function (app, io) {
|
httpServer = new Server(config, function (app, io) {
|
||||||
Log.log("Server started ...");
|
Log.log("Server started ...");
|
||||||
|
|
||||||
for (let nodeHelper of nodeHelpers) {
|
for (let nodeHelper of nodeHelpers) {
|
||||||
@@ -253,6 +254,7 @@ function App() {
|
|||||||
nodeHelper.stop();
|
nodeHelper.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
httpServer.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -92,6 +92,11 @@ function Server(config, callback) {
|
|||||||
if (typeof callback === "function") {
|
if (typeof callback === "function") {
|
||||||
callback(app, io);
|
callback(app, io);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.close = function () {
|
||||||
|
server.close();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Server;
|
module.exports = Server;
|
||||||
|
Reference in New Issue
Block a user