This is a Node.js-based API that provides access to Quran translations and explanations (tafseer). It allows users to retrieve full Quran data, specific chapters, and perform text searches within the Quran.
- Retrieve full Quran translations and explanations
- Get specific chapters with translations and explanations
- Search functionality to find verses containing specific terms
- CORS-enabled for cross-origin requests
- Node.js (v12 or higher recommended)
- npm (comes with Node.js)
-
Clone the repository:
git clone https://github.com/ibadkhan1996/quran-api.git cd quran-api
-
Install dependencies:
npm install
-
Ensure you have the necessary data files:
data/translations.txt
: Contains Quran translationsdata/tasfeer.txt
: Contains Quran explanations (tafseer)
To start the server:
npm start
The server will start on http://localhost:3000
by default, or on the port specified by the PORT
environment variable.
-
Get Full Quran Data
- Endpoint:
GET /api/quran
- Returns all Quran translations and explanations
- Endpoint:
-
Get Specific Chapter
- Endpoint:
GET /api/quran/:chapter
- Returns translations and explanations for a specific chapter
- Example:
/api/quran/1
returns data for Surah Al-Fatihah
- Endpoint:
-
Search Quran
- Endpoint:
GET /api/search?q=:searchTerm
- Searches for verses containing the specified term
- Example:
/api/search?q=mercy
returns all verses containing the word "mercy"
- Endpoint:
-
Root Route
- Endpoint:
GET /
- Returns a welcome message
- Endpoint:
The API includes basic error handling:
- 404 errors for chapters not found
- 500 errors for server-side issues
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GNU Affero General Public License v3.0 (AGPLv3). See the LICENSE file for details.
- Heroku for hosting the API
- [Mention any third-party data sources or libraries used]
Ibad Khan
Project Link: https://github.com/ibadkhan1996/quran-api