An API to fetch latest videos in every 10 seconds in sorted reverse chronological order of the publishing date from YouTube in paginated response.
- Cron Job to constantly fetch data in the background every 10 Second.
- GET API,
/
for fetching the videos stored in the Database in reverse order of publishing date. - GET API,
/page=page
for fetching the videos stored in the Database in reverse order of publishing date for particular page, every page will have 10 objects by default. - GET API,
/?search='EG'&page='0'
for fetching videos supporting options like search to search on the basis of title and description with partial matching and also paginated.
- Clone the project
git clone https://github.com/punitjain9615/YouTube-Fetch.git
Follow the instructions on API to get one API for fetching youtube videos.
Instructions to run Application:
- Default values of environment variables, refer .env.defaults file
- Please provide values to all those variabes.
- In case of multiple API keys, provide them as "," delimited list of keys like so:
YOUTUBE_API_KEY = "<API_KEY1>, <API_KEY2>..."
- Install dependencies
npm install
- Run in development mode
npm run start
When using Docker Compose,
- Create a
config.env
file using the instructions mentioned above - Set the
DATABASE_URI, QUERY and YOUTUBE_APIS
environment variable in yourconfig.env
file to - Please run:
docker-compose up
- Navigate to
http://localhost:3000
to see the app live in local machine