Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
## Product List


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.

If you have any questions about this project or the program in general, visit [parsity.io](https://parsity.io/) or email hello@parsity.io.
23 changes: 23 additions & 0 deletions product-list-BE/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
26 changes: 26 additions & 0 deletions product-list-BE/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Backend Setup

## Prerequisites

## Dependencies

- [Node.js](https://nodejs.org/) - JavaScript runtime environment.
- [MongoDB](https://www.mongodb.com/) - NoSQL database.
- [Mongoose](https://mongoosejs.com/) - MongoDB object modeling for Node.js.

## Installation

1. Clone the repository.
2. Navigate to the project directory.
3. Install dependencies:
```bash
npm install
```

To start the backend server, run: npm start

The server will run on port 8000 by default.

Modify the MongoDB connection string in app.js if needed.

Update routes and middleware as per your application requirements.
12 changes: 12 additions & 0 deletions product-list-BE/models/products.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;

const ProductSchema = new Schema({
categories: String,
name: String,
price: Number,
image: String,
reviews:[{ type: mongoose.Schema.Types.ObjectId, ref: 'Review' }]
});

module.exports = mongoose.model("Product", ProductSchema);
9 changes: 9 additions & 0 deletions product-list-BE/models/reviews.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const mongoose = require('mongoose');

const reviewSchema = new mongoose.Schema({
userName: String,
text: String,
product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product' }
});

module.exports = mongoose.model('Review', reviewSchema);
Loading