diff --git a/frontend/package.json b/frontend/package.json index 155262f..38b83cc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,6 +14,6 @@ "dependencies": { "express": "^4.17.1", "morgan": "^1.10.0", - "xml2js": "^0.4.23" + "promptly": "^3.2.0" } } diff --git a/frontend/static_server.js b/frontend/static_server.js index bcf5afe..1ac3862 100644 --- a/frontend/static_server.js +++ b/frontend/static_server.js @@ -1,5 +1,6 @@ -const express = require('express'); -const morgan = require('morgan' ); +const express = require('express' ); +const morgan = require('morgan' ); +const promptly = require('promptly'); const config = require('./config.js').load(process.argv[2]); @@ -11,4 +12,15 @@ const app = express(); app.use("/", morgan("dev")); app.use("/", express.static("webpage")); -app.listen(config.port); \ No newline at end of file +const server = app.listen(config.port); + +const prompt = input => { + if (/q(?:uit)?|exit/i.test(input)) { + server.close(); + } else { + promptly.prompt('') + .then(prompt); + } +}; + +prompt(); \ No newline at end of file