Changes to file structure to make it easier to add stuff to the app. No typescript was used.
CHANGES:
The "routes" and "controllers" folders were created.
In the "routes" folder, the developer can define which endpoints trigger which functions.
In the "controller" folder, the developer can implement the logic of functions for endpoints.
This separation will allow easier use of middleware in the future.
A "utils" folder was created with scripts to populate the database.
The "clearDatabase.mjs" script deletes all the products in the database.
The "populateDatabase.mjs" script inserts dummy products into the database.
This allows the developer to easily reset the database after testing API endpoints and changing data in the database. Read the README file inside "utils" folder for more details.
A "models" folder was created, but not used in the app. Models can be used later to enforce a specific structure for the data the server handles. It can make sure certain fields have default values.
"Items" was changed to "Products" to better reflect the data we are storing.
Endpoints were adjusted from "/items" to "/products", but the logic remains the same.
Changes to file structure to make it easier to add stuff to the app. No typescript was used.
CHANGES:
The "routes" and "controllers" folders were created.
A "utils" folder was created with scripts to populate the database.
A "models" folder was created, but not used in the app. Models can be used later to enforce a specific structure for the data the server handles. It can make sure certain fields have default values.
"Items" was changed to "Products" to better reflect the data we are storing.
To run
Clone Branch
Run command:
Setup .env files
Run command: