Inventory Tracker
This app is used to store information about items such as their title and quantity in inventory.
This requires npm, nodejs and mysql to be installed. This setup has only been tested on Ubuntu 20.04 and MacOS.
Install the server daemon.
sudo apt install mysql-server
CREATE USER 'inventrak'@'localhost' IDENTIFIED BY 'password';
grant all privileges on *.* to 'inventrak'@'localhost';
Please put the password you set in the .env
file of this project.
Run npm install
node setup.js
npm run server
This repo is spit into a few pieces
The client facing code that runs in the browser.
The server code used to run the backend.
server.js
- Entry point for the server code.
- Where the express route source code is located.
inventory.js
- Abstracted view for the inventory items.
csv.js
- Parser from a js object to csv format
mysqlInterface.js
- API between the server code and the database code.
orm.js
- Object relational mapping from the server data structures to SQL.
- Generates SQL statements.
schemas.js
- Schema information about the database.
Simple tests using the peter
testing framework.
Run the tests using the npm run test
command.
Standalone file that sets up the database used for this project.
Run with the "populate" flag to populate the database with test values. Usage: ./script.js populate
.
- Allow multiple files to be edited at once in one request. This would be done with one database pool connection.
- Add pagination to the list endpoint allowing for a subset of the data to be sent at a time. This would be helpful for performance on the frontend and backend.
- Add a cache for the most commonly requested items in inventory.
- Add more fields for inventory items such as description and price.
- Precent SQL injections by sanitizing data.