Skip to content

Commit

Permalink
add appListener for close app and update default port
Browse files Browse the repository at this point in the history
  • Loading branch information
charleston10 committed Jul 7, 2022
1 parent bcb368e commit b2d2769
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/mockenzo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ module.exports = function () {
const app = express();
app.use(express.json())

let portAddress;
const portDefault = 3000

let appListener;
let portAddress;
let configs = [];

let config = {
Expand Down Expand Up @@ -103,11 +105,13 @@ module.exports = function () {
},
start: function (run) {
builderRequests();
app.listen(portAddress || 3636);
appListener = app.listen(portAddress || portDefault);
if (run) run()

return this;
},
stop: function () {
app.close()
appListener.close()
}
};
};

0 comments on commit b2d2769

Please sign in to comment.