This is a Node.js API client written in TypeScript that uses the rest API at alquran.cloud to fetch Quran Ayahs, Surahs Juzs or the entire Quran.
The API Client is a composer package. To use it, you need to run the following:
yarn add alquran-api-client
or
npm i --save alquran-api-client
import AlQuranApiClientNode from 'alquran-api-client';
To get a single ayah, use:
AlQuranApiClientNode.getAyah('1').then((ayah: Ayah) => {
// "ayah" will be Ayah 1
});
AlQuranApiClientNode.getAyah(765, 'en.pickthall').then((ayah: Ayah) => {
// "ayah" will be Ayah 765 with Marmaduke Pickthall's English translation
});
To get a surah, use:
AlQuranApiClientNode.getSurah(36).then((surah: Surah) => {
// "surah" will be Surah Yaseen
});
AlQuranApiClientNode.getSurah(36, 'en.saad').then((surah: Surah) => {
// "surah" will be Surah Yaseen with Muhammad Asad's English translation
});
To get a juz, use:
AlQuranApiClientNode.getJuz(30).then((juz: Juz) => {
// "juz" will be Juz 30 (there are only 30!)
});
Please see all available API methods in the examples directory.
Meezaan-ud-Din Abdu Dhil-Jalali Wal-Ikram (@meezaan). [email protected]
iSecNew10 OpenSource (@iSecNew10). [email protected]
For support, please visit http://alquran.cloud/api or http://alquran.cloud/contact.