/Get-Youtube_subscribers

A capstone project where I learnt about back end development with a deep dive in to node , express and mongo db with mongoose

Primary LanguageJavaScript

Get-Youtube-Subscribers (AlmaBetter__Capstone__Project)

Folder Structure

    Get-Youtube_subscribers  

├─ src
│ ├─ models
│ │ └─ subscribers.js
│ ├─ app.js
│ ├─ createDatabase.js
│ ├─ data.js
│ ├─ index.html
│ └─ youtube.png
├─ index.js
├─ package-lock.json
├─ package.json
├─ Readme.md
└─ vercel.json

Introduction

  • A backend project which includes specific routes in the URL .
  • User can do the following as below:
    • access the number of subscribers,
    • access subscribers by specific IDs and names,
    • add subscribers, &
    • delete subscibers

Used in this project:

  • Mongoose
  • Express
  • MongoDB (Atlas and Compass)
  • Raw data
  • Vercel.json to deploy at vercel
  • Path module to join index.html
  • Postman || Insomnia
  • nodemon
  • dotenv

Steps :

  • Step 1

Install npm dependencies of express and mongoose using " npm install " command.

  • Step 2

Using MongoDB local (Compass) as well as MongoDB Cloud (Atlas), depends on you which you want to use Just uncomment and comment the codes vice versa in createDatabase.js and index.js

    • note : To demonstrate I am using deployed project over the vercel
      image

Start the backend server using nodemon or node index.js command.

  • Step 3

  • GET http://localhost:3000/ → The client will see an interface as below:
    image

  • GET http://localhost:3000/subscribers → When the user hit this, endpoint /subscribers, the client will get an array of all subscribers in JSON format from the database where the data is stored in local or MongoDB cloud database.

image

  • GET http://localhost:3000/subscribers/names →When the user hit this, endpoint /subscribers/names the client will to get an array of all subscribers in JSON format with only name and subscribed Channel fields from the database, where the data is stored in local or MongoDB cloud database.

image

  • GET http://localhost:3000/subscribers/:id → When the user hit this, endpoint /subscribers/:id in ID, the user needs to enter the USER’S ID which is stored in the database to get a particular user’s details like name, subscribed Channel and subscribed Date from the database, where the data is stored in local or MongoDB cloud database.

image

  • GET http://localhost:3000/invalid → when the user hit the unwanted route which is not mentioned above (which is used to handle all other requests), they will get an error message like Route not found in JSON format with an 404 error status code.

image

app.use() is used to handle all the unwanted requests. It will return 404 Not Found status code indicating that the requested resource could not be found but may be available in the future.

Insomnia (Adding subscriber) image

Postman (Deleting Subscriber with added subscriber id)

image

  • -fetching again to check subscriber deleted or not

image

FAQ

How to add new subscribers & delete ?

Use Postman or Insomnia to add new subscribers, Delete subscribers from the database.

Deployment

Use Json Viewer extension in Browser for better view

live link
https://youtube-sub-get.vercel.app/

Demo Video link
https://youtu.be/dJPzO5hG4rw