An Express.js API for fetching and filtering Kabir's dohas, hosted on Vercel.
Kabir Ke Dohe API provides a collection of Kabir's dohas (couplets) that you can filter, sort, and paginate. This API is built with Express.js and is hosted on Vercel. It supports various query parameters to help you retrieve the exact data you need.
Fetch filtered and paginated couplets based on query parameters.
s
(string): Search term.exactMatch
(boolean): Whether to use exact match for search (true
orfalse
).searchWithin
(string): Fields to search within (comma-separated list ofcouplet
,translation
,explanation
).tags
(string): Tags to filter by (comma-separated list of tags).popular
(boolean): Whether to filter by popularity (true
orfalse
).orderBy
(string): Field to sort by (id
,couplet_english
,couplet_hindi
,popular
).order
(string): Sort order (ASC
orDESC
).page
(number): Current page number.perPage
(number): Number of items per page.pagination
(boolean): Whether to include pagination info (true
orfalse
).
{
couplets: [
{
id: "1",
slug: "couplet-slug",
unique_slug: "couplet-slug-with-id-and-unique-hash",
couplet_hindi: "हिन्दी में दोहा",
couplet_english: "English couplet",
translation_hindi: "हिन्दी में अनुवाद",
translation_english: "English translation",
explanation_hindi: "हिन्दी में व्याख्या",
explanation_english: "English explanation",
tags: [
{ slug: "tag1", name: "name1", count: 1 },
{ slug: "tag2", name: "name1", count: 1 },
],
popular: true,
},
],
total: 100,
totalPages: 10,
page: 1,
perPage: 10,
pagination: true,
},
curl "https://kabir-ke-dohe-api.vercel.app/api/couplets"
curl "https://kabir-ke-dohe-api.vercel.app/api/couplets?s=love&exactMatch=false"
curl "https://kabir-ke-dohe-api.vercel.app/api/couplets?tags=spiritual,life"
curl "https://kabir-ke-dohe-api.vercel.app/api/couplets?popular=true"
curl "https://kabir-ke-dohe-api.vercel.app/api/couplets?orderBy=couplet_hindi&order=ASC"
curl "https://kabir-ke-dohe-api.vercel.app/api/couplets?page=2&perPage=5"
curl "https://kabir-ke-dohe-api.vercel.app/api/couplets?s=wisdom&exactMatch=true&searchWithin=translation,explanation&tags=philosophy&popular=false&orderBy=id&order=DESC&page=1&perPage=10"
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/vijayhardaha/kabir-ke-dohe-api.git cd kabir-ke-dohe-api
-
Install dependencies:
npm install
-
Create an
.env
file in the root directory and add any necessary environment variables. -
Start the server:
npm start
Once the server is running, you can access the API at http://localhost:3000/api/couplets
. Use the provided query parameters to filter, sort, and paginate the dohas as needed.
This project is licensed under the MIT License. See the LICENSE file for details.