Skip to content

Commit 7eb88ec

Browse files
committed
final readme
1 parent 3c91c81 commit 7eb88ec

File tree

1 file changed

+103
-1
lines changed

1 file changed

+103
-1
lines changed

README.md

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,103 @@
1-
# YoutubeSearchApi
1+
# YoutubeSearchApi
2+
3+
[![Node.js CI](https://github.com/mohitdmak/YoutubeSearchApi/actions/workflows/node.js.yml/badge.svg?branch=main)](https://github.com/mohitdmak/YoutubeSearchApi/actions/workflows/node.js.yml)
4+
5+
## API Paths
6+
> After following the installation process below and starting project, the api shall be listening for requests at port 3000.
7+
8+
- /
9+
> Home path, app shall respond with a simple json acknowledgement
10+
11+
- /search/< query >
12+
> Insert query which you want your Data API v3 to send results for, which will be sorted by latest uploaded and return max responses of 2
13+
( hard coded, can change at ./controllers/searchController.js)
14+
15+
- /find/< query >
16+
> Filter responses by video's title or description or both.
17+
Server expects them to be values of keys:
18+
"title"
19+
"description"
20+
in url query strings.
21+
22+
> The < query > must have been searched for before in order to filter by title or description.
23+
24+
## To start,
25+
26+
<details>
27+
<summary> Create a Mongo Atlas Connection URI</summary>
28+
<br>
29+
- Login to Mongo Atlas
30+
- Create a project and build new cluster ( it provides a free sandbox )
31+
- Create Database users and secure network access to your machine's IP only
32+
- Create a database which has 2 collections:
33+
- videos
34+
- searches
35+
- Obtain a connection uri for node version > 14
36+
</details>
37+
38+
<details>
39+
<summary> Get a Youtube Data API V3 key</summary>
40+
<br>
41+
42+
- Visit Google Api Console, https://console.cloud.google.com/
43+
44+
- Create a new project and enable the Yt Data API v3 at https://console.cloud.google.com/apis/api/youtube.googleapis.com
45+
46+
- Create Credentials and secure the key to allow access to only the created api, and download credentials into your project folder
47+
48+
- Preferrably procure multiple keys as the project will automatically cycles through keys, as their request quotas get exhausted.
49+
</details>
50+
51+
### Get the project in your local machine
52+
- Fork the project
53+
- Clone by following on terminal at preferred directory
54+
55+
```
56+
git clone https://github.com/<Your_Username>/YoutubeSearchApi.git
57+
```
58+
59+
### Setup the config folder
60+
61+
- Copy and export the Mongo connection uri into a file at
62+
./config/mongouri.js
63+
from your project.
64+
65+
- Copy and export (as an array) the set of all api keys at
66+
./config/apiKey.js
67+
from your project.
68+
69+
### Containerise app
70+
- This requires your machine to have Docker runtime installed. If it isnt already install by refering these
71+
- (Mac OS) https://docs.docker.com/docker-for-mac/install/
72+
(Windows) https://docs.docker.com/docker-for-windows/install/
73+
(Linux) https://docs.docker.com/engine/install/ (Browse by distributions)
74+
75+
- Further Install docker compose
76+
https://docs.docker.com/compose/install/
77+
78+
- Create docker image and containers
79+
- You may need to create a user group or else run as sudo
80+
```
81+
docker-compose up --build
82+
```
83+
<br>
84+
85+
#### You can run app without docker in case of issues by:
86+
87+
- Initiating project with npm pm
88+
```
89+
npm init -y
90+
```
91+
- Installing dependancies
92+
```
93+
npm install i
94+
```
95+
- Test Npm Script:
96+
```
97+
npm run test
98+
```
99+
- Starting Project
100+
```
101+
npm run start
102+
```
103+

0 commit comments

Comments
 (0)