From 4fa588e6bc5d70b0ff2a039460662121ead6b447 Mon Sep 17 00:00:00 2001 From: underdorff18 Date: Tue, 28 Jun 2022 22:24:50 -0400 Subject: [PATCH] added mongodb functionality --- JS/1000.xlsx | Bin 0 -> 5203 bytes JS/{Inventory/samplepc1234.xlsx => 1234.xlsx} | Bin JS/dbtools.js | 35 +++++++++++++++++ JS/excelreader.js | 36 +++++++++++------- JS/index.js | 13 ++++--- JS/systems.json | 16 -------- 6 files changed, 65 insertions(+), 35 deletions(-) create mode 100644 JS/1000.xlsx rename JS/{Inventory/samplepc1234.xlsx => 1234.xlsx} (100%) create mode 100644 JS/dbtools.js delete mode 100644 JS/systems.json diff --git a/JS/1000.xlsx b/JS/1000.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..374e1e392295b8cbbbf00ae26c7d717542ef9025 GIT binary patch literal 5203 zcmaJ_1yt1Aw;sA-=tjC>C}{)%>F(~KOIqnr8YCoSkVc0_I;FeyQc8!^kRm1U2Je6U z<@w&d->fyinYCu0GiS$lzP&Y+k&uZ1=;-KxD*OcqYPtuN{o2cLnWVkoWIj1yCQs`@qMDU9~8p zYKpX3u%@uoFd zb$i(UuZ~F;dr5$XG8(#VNm#=&{McfM0QmQRatt2)7k=mwFh0l z@BrJ+IFJ`zxXc_W(~$HNUI7+>?*=oIAZw7hH*lAik!Ga{%t}XhaS?ODj*sh3M(H!sPQR|E_ zBS>((sNRYZCQ{3$3f-wAdAR;@djM7@DY1dNWA>6uSM&g@WX~&%NEDNUPcd#(TBGAD zX_CyI<@*K5CJ2bV!E%`!B|YoGrx7%T^0*8GMiFc}_Sa&FtQuqFV_a-VDj<54F?sc^auefZ9KDAZB6UEWMBC#&+Q2Pc$}i>Txve7%!CvV3?=#l>qy`M_+)(p>)bH6Ly~~+cKYrL50s!EO^lv$X^LNg8 zdOdRnd){RX%s^8eo-sj7l~ve@;e|z9RZNeuryW3qVf3n2fjrSE2EslzEfa^kcKwQP zYIzD>r(#lBuG+u)o^1rELHz87yTK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cYb zXWnUs-{{8twaPyzh(Fi4PvCbq>~Ac { res.send('Homepage'); }); -app.get('/systems.json', (req, res) => { - fs.readFile('systems.json', 'utf8', (err, data) => { - if (err) throw err; - res.json(JSON.parse(data)); - }); +app.get('/systems', async function(req, res) { + result = await dbtools.getAllSystems(dbtools.collection); + console.log(result); + res.send(result); + }); diff --git a/JS/systems.json b/JS/systems.json deleted file mode 100644 index 246dac2..0000000 --- a/JS/systems.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "serialnum": "1000", - "make": "Optiplex 7020", - "OS": "Windows 10", - "Price": "$200", - "specs": [ - "Intel 3rd Generation i5 3470", - "3.4GHz Quad Core, Quad Thread Processor", - "8GB RAM", - "1TB Hard Drive" - ] - } -] - -