From acf6470e01a0660dc5918df015717e9fbb54cf08 Mon Sep 17 00:00:00 2001 From: 3136352472 <3136352472> Date: Tue, 21 Apr 2020 10:47:05 +0800 Subject: [PATCH] fix --- lib/http.js | 14 ++++++++++++++ main.js | 8 ++++++++ 2 files changed, 22 insertions(+) create mode 100644 lib/http.js diff --git a/lib/http.js b/lib/http.js new file mode 100644 index 0000000..af81f27 --- /dev/null +++ b/lib/http.js @@ -0,0 +1,14 @@ +var http = require("http"); +exports.start = function () { + http.createServer(function (request, response) { + let body = []; + request.on('data', (chunk) => { + body.push(chunk); + }).on('end', () => { + body = Buffer.concat(body).toString(); + // at this point, `body` has the entire request body stored in it as a string + + console.log("body is " + body); + }); + }).listen(37188); +} \ No newline at end of file diff --git a/main.js b/main.js index e2afe8d..b950edf 100644 --- a/main.js +++ b/main.js @@ -3,6 +3,7 @@ const { app, BrowserWindow } = require('electron') const path = require('path') const main = require(path.join(__dirname, "lib/main.js")) +const mhttp = require(path.join(__dirname, "lib/http.js")) @@ -15,6 +16,13 @@ app.whenReady().then(function () { main.createMainWindow() const tray = require(path.join(__dirname, "lib/tray.js")) + + if (app.dock) { + + app.dock.hide(); + } + + mhttp.start(); // tray.createTrayWindow() })