Skip to content

Commit

Permalink
small refactor to fit specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
underdorff18 committed Jun 25, 2022
1 parent c362ddb commit aa9d21c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
Binary file added JS/Inventory/samplepc1234.xlsx
Binary file not shown.
19 changes: 19 additions & 0 deletions JS/excelreader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fs = require('fs');
const path = require('path');
const xlsx = require('xlsx');

const myfilepath = path.join(__dirname, 'Inventory', 'samplepc1234.xlsx');

function readInventoryFile(filepath) {
const workbook = xlsx.readFileSync(filepath);
const sheetNames = workbook.SheetNames;
const data = workbook.Sheets[sheetNames[0]];
console.log(data);

//Here is where we use known cell locations of the specs needed to build the systems file
}


readInventoryFile(myfilepath);
//console.log('yo');

16 changes: 11 additions & 5 deletions JS/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
const express = require('express', '4.17.1');
const fs = require('fs');
const app = express();
const myparse = require('./parse');
//const myparse = require('./parse');
const port = 3000;


console.log(JSON.stringify(myparse.systems));

app.get('/', (req, res) => {
res.send('Hello World!');
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.listen(port, () => {
console.log('Listening at http://localhost:${port}');
console.log(`Listening at http://localhost:${port}`);
});
11 changes: 0 additions & 11 deletions JS/parse.js

This file was deleted.

File renamed without changes.

0 comments on commit aa9d21c

Please sign in to comment.