Created with CodeSandbox
This Project have 3 collection products,videos,and comments
- Products Collection
-store
-description
-tags
-price
-count
- Videos Collection
-_id
-judulVideo
-linkYt
-productId
- Comments Collection
-_id
-username
-comment
-timeStamp
-videoId (this one for connecting comment and the video)
Endpoint Ready to use
GET /
GET /videos
GET /videos/:id < to get the specific product>
POST /videos/:id/comment
Return Dashboard Home
* **URL Params**
None
* **Data Params**
None
* **Headers**
* **Success Response:**
* **Code:** 200
**Content:**
Return All Videos from Database
* **URL Params**
None
* **Data Params**
None
* **Headers**
showing all database /videos
* **Success Response:**
* **Code:** 200
**Content:**
Return Video By Id and show comment
Return json `message `
* **URL Params**
None
* **Data Params**
None
* **Headers**
showing dashboard for videos/:id
* **Success Response:**
* **Code:** 200
**Content:**
Creates new comment and return "keren dah bisa"
* **URL Params**
None
* **Data Params**
None
* **Headers**
Content-Type: application/json
* **Success Response:**
* **Code:** 200
**Content:**
To run the application locally, follow these steps:
-
First, make sure you have downloaded all the required dependencies. The list of dependencies you need are:
- body-parser (version 1.20.2 or higher)
- dotenv (version 16.3.1 or higher)
- ejs (version 3.1.9 or higher)
- express (version 4.18.2 or higher)
- express-ejs-layouts (version 2.5.1 or higher)
- mongoose (version 7.4.0 or higher)
- nodemon (version 2.0.22 or higher)
-
To install all these dependencies, open your terminal or command prompt and navigate to the root directory of your cloned repository.
-
Then, execute the following command:
npm i body-parser dotenv ejs express express-ejs-layouts mongoose nodemon
This command will use npm (Node Package Manager) to download and install all the listed dependencies.
-
After all the dependencies have been installed successfully, you can start the local server by running the following command in your terminal:
npm run start
This command will execute the script defined in the
start
field of the "scripts" section in yourpackage.json
file. Usually, this script starts your application using nodemon, which helps to automatically restart the server whenever changes are detected, making the development process more convenient. -
Once the server is running, you should be able to access your application locally by navigating to the appropriate address in your web browser (http://localhost:3000)
1. go to your visual studio code and open terminal "git clone https://github.com/reyangga9/midterm-GIGIH"
2. cd to midterm-Gigih and install this at terminal-> "npm i body-parser dotenv ejs express express-ejs-layouts mongoose nodemon"
3. npm run start
4. to check some videobyId and see the comment -> http://localhost:3000/videos/64c23cfbb484ae1bf5cf9eed