Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9324eaf
Initial project setup
sswaringin Jul 2, 2024
17c2632
Removing dependency directory
sswaringin Jul 2, 2024
001ad51
2nd attempt at removing node_modules
sswaringin Jul 2, 2024
43914ab
Making server routes, Making schemas for product and review
sswaringin Jul 7, 2024
4f256e1
Upgrading faker library, Updating setup documentation
sswaringin Jul 7, 2024
f24d6f1
separating handler functions from Express routes
sswaringin Jul 8, 2024
85975c5
Splitting product routes and route for creating fake data
sswaringin Jul 10, 2024
3027858
Refactoring getProducts function to query product category, Added err…
sswaringin Jul 10, 2024
1331cea
Adjusting page query for getProducts function, Added price sorting to…
sswaringin Jul 10, 2024
bc6ba9c
Adding query parameter 'query' that searches name and category for a …
sswaringin Jul 10, 2024
368a2fd
Moving backend to its own folder
sswaringin Jul 11, 2024
431e976
Adding Next project for frontend
sswaringin Jul 11, 2024
21ad1bf
Adding testing with mocha and chai
sswaringin Jul 11, 2024
59aba7e
Setup tests for each http route
sswaringin Jul 11, 2024
9045941
Improving error handling and tests
sswaringin Jul 12, 2024
09550e2
Starting React and Redux setup
sswaringin Jul 12, 2024
3ebd1da
Fixing ESLint issue, Applied workaround for CORS, Redux is successful…
sswaringin Jul 12, 2024
77e7831
Adding Bootstrap, Getting Asyncthunk to run when page renders, Starti…
sswaringin Jul 12, 2024
d1a23cf
Adding ProductContainer component, Adjusting ProductCard, Improving d…
sswaringin Jul 12, 2024
0860a1b
Started pagination feature
sswaringin Jul 12, 2024
c036bb6
Refactoring ProductPageNav
sswaringin Jul 13, 2024
083c083
ProductPageNav working as intended
sswaringin Jul 13, 2024
97d5c18
Completed ProductSearch component
sswaringin Jul 14, 2024
2be902c
Adjusting display of ProductCard
sswaringin Jul 14, 2024
5db70f7
Starting ProductCategory selection component
sswaringin Jul 14, 2024
e77c38d
Starting category filter on backend
sswaringin Jul 14, 2024
97343cd
Added route and function to get all unique categories of products
sswaringin Jul 14, 2024
ad3fda5
Merge branch 'master' into frontend-categories
sswaringin Jul 14, 2024
fd9145f
Creating new AsyncThunk to pull categories, Pulling all categories to…
sswaringin Jul 15, 2024
c01dfda
Completed ProductCategories component
sswaringin Jul 15, 2024
87fdaec
Creating ProductPrice component to sort products by price
sswaringin Jul 15, 2024
46af16e
Refactoring ProductCategories to use categorySelected action reducer
sswaringin Jul 15, 2024
20c83a2
Refactoring ProductSearch component to use searchUpdated action reducer
sswaringin Jul 15, 2024
5927207
Refactoring pagination to use pageSelected action reducer
sswaringin Jul 15, 2024
d5c96b7
Further adjusting page selection to work when category filter, price …
sswaringin Jul 16, 2024
d8af821
Improving documentation, Correcting ESLint errors
sswaringin Jul 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.workingDirectories": ["./frontend", "./backend"]
}
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
## Product List
# Product List

## Description

This project has been created by a student at Parsity, an online software engineering course. The work in this repository is wholly of the student based on a sample starter project that can be accessed by looking at the repository that this project forks.
This project is intended to run on a Node.js server to provide a fictitious e-commerce site using Express and MongoDB.

If you have any questions about this project or the program in general, visit [parsity.io](https://parsity.io/) or email hello@parsity.io.
## Getting Started

To start the backend, `cd backend/` > `npm install` > `npm run start`. The backend runs at http://localhost:8000.

To start the frontend, `cd frontend/` > `npm install` > `npm run dev`. The frontend runs at http://localhost:3000.

This assumes MongoDB is already installed and running on the default port.
https://www.mongodb.com/docs/manual/administration/install-community/

## Generating Fake Data
Once the backend is running, you can generate fake data by sending a GET request to:
http://localhost:8000/get-fake-data

## Testing

There are automated tests using mocha and chai to help ensure server functionality remains consistent as changes are made. To run the tests, make sure your terminal is in the 'backend/' directory and run 'npm run test'.
1 change: 1 addition & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
15 changes: 15 additions & 0 deletions backend/models/product.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const { reviewSchema } = require('./review');

const productSchema = new Schema({
category: String,
name: String,
price: Number,
image: String,
reviews: [ reviewSchema ] // Adding reviews as subdocuments
});

const Product = mongoose.model('Product', productSchema);

module.exports = { Product };
9 changes: 9 additions & 0 deletions backend/models/review.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const reviewSchema = new Schema({
username: String,
text: String,
});

module.exports = { reviewSchema };
Loading