submitted by Mustafiz Kaifee
-
Clone or Download this repo.
-
run
npm i
-
Put API_KEY in
youtubeApiKeys.js
file -
create
.env
file in the root directory or rename.env.sample
to.env
. Add or update the port and database URL.PORT=3000
DB_URI=mongodb://localhost:27017/fampay_youtube
-
To start the server run
npm run start
-
The server will start running on the port you specify start query YouTube videos and keep adding them to the database.
-
To test the search and query API. Copy the URL or import the curl for that.
i. Search all video API -> http://localhost:3000/video
`curl --location 'http://localhost:3000/video/'`
ii search video by query -> http://localhost:3000/video/search?q=india&page=1
`curl --location 'http://localhost:3000/video/search?q=india&page=1'`
- Download docker.
- Build a docker image using the command
docker build -t <image_name> .
- Before starting the docker update the DB_URL inside
docker-compose.yml
file to the actual db URL or keep it as if you are using local Mongodb. - Start the docker
docker compose up
- The server will start running on the port you specify.