Steps to install the project locally
$ git clone https://github.com/Krishna-7777/Hack2Skill-Task2.git
$ cd backend
$ npm i
$ node index.js
You have to also add a .env file
DBURL
=<Your_MongoDb_Connection_String/DBname>
key
=Youtube_API_KEY
Retrieve paginated videos.
page (optional): The page number to fetch (default: 1).
limit (optional): The number of videos per page (default: 10).
{
"totalVideos": 100,
"totalPages": 10,
"currentPage": 1,
"videos": [
{
"title": "Video 1",
"channelTitle": "Channel 1",
"description": "Video description",
"thumbnailURL": "https://example.com/video1.jpg",
"publishedAt": "2023-07-18T12:00:00.000Z"
},
// more videos...
]
}
Search for videos based on a query.
q (required): The search query string.
limit (optional): The number of search results to return (default: 5).
{
"results": [
{
"title": "Video 1",
"channelTitle": "Channel 1",
"description": "Video description",
"thumbnailURL": "https://example.com/video1.jpg",
"publishedAt": "2023-07-18T12:00:00.000Z"
},
// more search results...
]
}