👋 Hey There,
this repository houses my code for the Get Youtube Subscribers API. This app was made as part of my Almabetter course, for my Backend Capstone Project.
This API project has 3 endpoints /subscribers
, /subscribers/names
and /subscribers/:id
. Here the response is in JSON format and being a Backend Project there is no Frontend to this and was not a part of the acceptance criteria as well. The code here is entirely javascript.
- About it's Working
- Getting Started
- Languages/Database Used
- Relevant Links
API calls
Below are endpoints/pathnames you can call on localhost
or on the deployed link. All of these are GET requests.
/subscribers
: This is the first endpoint. After making this call the server responds with an array of objects of subscribers with all their details./subscribers/names
: This is the second endpoint. After making this request the server responds with an array of objects containing only the names of subscribers and subscribedChannel as their fields./subscribers/:id
: This is the last endpoint. You provide an ID here in place of :id. There are two cases here:- if the id matches it returns one object matching the id field with all the details of the subscriber.
- if the ID does not match it returns an error message and a status code of 400.
Testing and Deployment
Also, this API is deployed on Render.com and the testing and validation is done with the help of POSTMAN. API schema documentation has also been made with POSTMAN. After navigating to the deployment URL add the pathnames mentioned above.
Locally
Type git clone <paste the URL for this repository>
in your cmd and use it for yourself.
To start using the API on your software like POSTMAN or running on a browser follow these steps :
- in the
.\src
runnpm install mongoose express nodemon
command. - Navigate to the appropriate path with cd and run the command
node .\createDatabase.js
to create the database. - Navigate to the appropriate path with cd and then run the command
nodemon .\index.js
and wait for the messages connected to MongoDB Atlas successfully and server is running on Port 3000 to appear and you are all set to use this API locally.
Forking
You can also clone this repository or submit a pull request here. To submit a pull request you can follow the steps given below:
- Copy or fork the remote repository.
- Download or clone your copy of the repository to your local filesystem.
- Navigate to your copy of the repository and click the green "Clone or download" button. Click the clipboard next to the https clone URL to copy it.
- At the command prompt enter the following
git clone <the pasted URL>
- Create a new branch to work your edits, switch to that branch, change to your new repository, and type
git checkout -b <newbranchname>
- Make your change, commit it (adding a clear and concise commit message), and push it to your local copy of the repository on GitHub. You will need to set the origin for your new branch the first time you push it up, so use the following code:
git push -u origin <newbranchname>
- Navigate to the original GitHub repository, and you should see a big green button marked "Compare and pull request".
- Click that button and you will be taken to a page giving you to describe your pull request and show you the changes you have made. Write a clear and concise subject and description for your change asking for a merge.
Note: You need to have installed Node Js installed on your device to run this code.
Following are used to create the website
- Deployed with Render: https://get-youtube-subscribers-bp-st.onrender.com/
- Link for local cloning: https://github.com/shaswattejankar/youtubesubscribers.git
- API schema documentation: https://documenter.getpostman.com/view/29625170/2s9YC4VYRw